[FFmpeg-devel] [PATCH] Mimic decoder

Michael Niedermayer michaelni
Thu May 15 18:03:00 CEST 2008


On Thu, May 15, 2008 at 04:06:03AM +0100, Ramiro Polla wrote:
>
>>>>> Attached are the 2 patches I used to test. (lut_calc.diff and 
>>>>> lut_static.diff). Anyways, most FFmpeg stuff introduced a considerable 
>>>>> speedup over the original code, so I'm tempted to apply one of these 
>>>>> two.
>>>>> Could I use the hardcoded tables ifdef there?
>>>> I dont see much sense in it. I mean the calc code doesnt need the table 
>>>> at
>>>> all and needs around 100 byte while the table needs 1024.
>>> If it's ok I'd prefer to keep the current code with vlcdec_lookup in 
>>> MimicContext.
>> You can keep it if you merge the *qscale into the table as its not
>> const then anymore ...
>
> Oh, now I get it... Attached patch speeds up by 31%. The official encoder 
> and libmimic too IIRC do not change the quality between frames. If there 
> are quality changes then this new code probably slows down since it'll have 
> to update the table all the time. If I find a case where that'll be needed, 
> then I can probably have more tables in the context, keep the most recent 
> ones and overwrite old ones. But that's for later.
[...]
> @@ -103,6 +106,24 @@
>      53, 60, 61, 54, 47, 55, 62, 63,
>  };
>  
> +static void initialize_vlcdec_lookup12(int16_t vlcdec_lookup[9][64])
> +{
> +    int i, j;
> +
> +    for(i = 1 ; i < 8 ; i++) {
> +        int cur = (1<<i)-1;
> +        int last = 1<<(i-1);
> +
> +        for(j = 0 ; cur >= last ; cur--) {
> +            const int cur4 = cur << 4;
> +            vlcdec_lookup[i][j++] = -cur4;
> +            vlcdec_lookup[i][j++] =  cur4;
> +        }
> +    }
> +}
> +
> +static int16_t vlcdec_lookup12[9][64];
> +
>  static av_cold int mimic_decode_init(AVCodecContext *avctx)
>  {
>      MimicContext *ctx = avctx->priv_data;
> @@ -117,48 +138,12 @@
>      }
>      dsputil_init(&ctx->dsp, avctx);
>      ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, col_zag);
> +    initialize_vlcdec_lookup12(vlcdec_lookup12);
>  
>      return 0;
>  }
>  
> -const static int8_t vlcdec_lookup[9][64] = {
> -    {    0, },

why?
const static tables can be shared between processes, non const tables
can not also what do you gain be mergin the <<4 in the table? Is it really
worth the *2 size ?

and anyway this would be a seperate change & patch if we would decide that
it is a good idea ...

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080515/7e87bc99/attachment.pgp>



More information about the ffmpeg-devel mailing list