[Ffmpeg-devel] [PATCH] CYUV encoder resurrected

Michael Niedermayer michaelni
Sat Mar 3 13:20:05 CET 2007


Hi

On Fri, Mar 02, 2007 at 08:10:12PM -0700, Loren Merritt wrote:
> Baptiste Coudurier wrote:
> >Baptiste Coudurier wrote:
> >>Michael Niedermayer wrote:
> >>>Baptiste Coudurier wrote:
> >>>
> >>>>+ uint8_t y_buf[s->avctx->width];
> >>>>+ uint8_t u_buf[s->avctx->width>>2];
> >>>>+ uint8_t v_buf[s->avctx->width>>2];
> >>>>+ pict->error[0] += quantize_row_trellis(avctx, y_ptr, y_buf, y_table, 
> >>>>y_itable, s->avctx->width);
> >>>>+ pict->error[1] += quantize_row_trellis(avctx, u_ptr, u_buf, u_table, 
> >>>>u_itable, s->avctx->width>>2);
> >>>>+ pict->error[2] += quantize_row_trellis(avctx, v_ptr, v_buf, v_table, 
> >>>>v_itable, s->avctx->width>>2);
> >>>could be put into a loop maybe, the same applies to other similar YUV 
> >>>cases
> >>>of course only if the resulting code is simpler
> 
> Yes, it's simpler.
> 
> >>+static int quantize_sample(int sample, int *pred, const int8_t *table, 
> >>const uint8_t *itable)
> >>+{
> >>+    int p = *pred;
> >>+    int bi = itable[(sample - p) & 0xff];
> >>+    *pred = p + table[bi];
> >>+    if(*pred & ~0xff){
> >>+        int i, bscore=INT_MAX;
> >>+        for(i=0; i<16; i++){
> >>+            int score = abs(sample - ((p + table[i]) & 0xff));
> >
> >Rah, that is changed to FFABS in my tree.
> 
> Better yet, don't compute abs at all. The whole codec (without trellis) is
> 13% faster this way.

hmm, if this code matters so much speedwise then i think it could be changed
to
int p = *pred;
int bi = itable[(sample - p) & 0xff];
*pred = p + table[bi];
if(*pred & ~0xff){
    bi = itable2[(sample - p) & 0xff];
    *pred = p + table[bi];
}

where itable2 rounds in the oposite direction than itable


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070303/d8a0610c/attachment.pgp>



More information about the ffmpeg-devel mailing list