[FFmpeg-devel] [PATCH] Limit Rice parameter for progressive decoding in ALS
Thilo Borgmann
thilo.borgmann
Sat Feb 13 21:18:08 CET 2010
Am 13.02.10 20:54, schrieb Justin Ruggles:
> Thilo Borgmann wrote:
>
>> Hi,
>>
>> as in $subject, the reference encoder limits the Rice parameter during
>> progressively coding the first few samples of a random access block.
>>
>> Yet another "feature" not specified in 14496-3...
>
> Fun. Nice catch.
>
>
>> Regards,
>> Thilo
>>
>>
>
>> Index: libavcodec/alsdec.c
>> ===================================================================
>> --- libavcodec/alsdec.c (Revision 21799)
>> +++ libavcodec/alsdec.c (Arbeitskopie)
>> @@ -192,6 +192,7 @@
>> unsigned int frame_id; ///< the frame ID / number of the current frame
>> unsigned int js_switch; ///< if true, joint-stereo decoding is enforced
>> unsigned int num_blocks; ///< number of blocks used in the current frame
>> + unsigned int s_max; ///< maximum Rice parameter allowed in entropy coding
>> uint8_t *bgmc_lut; ///< pointer at lookup tables used for BGMC
>> unsigned int *bgmc_lut_status; ///< pointer at lookup table status flags used for BGMC
>> int ltp_lag_length; ///< number of bits used for ltp lag value
>> @@ -720,9 +721,9 @@
>> if (opt_order)
>> bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4);
>> if (opt_order > 1)
>> - bd->raw_samples[1] = decode_rice(gb, s[0] + 3);
>> + bd->raw_samples[1] = decode_rice(gb, FFMIN(s[0] + 3, ctx->s_max));
>> if (opt_order > 2)
>> - bd->raw_samples[2] = decode_rice(gb, s[0] + 1);
>> + bd->raw_samples[2] = decode_rice(gb, FFMIN(s[0] + 1, ctx->s_max));
>>
>> start = FFMIN(opt_order, 3);
>> }
>> @@ -1508,6 +1509,11 @@
>> avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8;
>> }
>>
>> + // set maximum Rice parameter for progressive decoding based on resolution
>> + // This is not specified in 14496-3 but actually done by the reference
>> + // codec RM22 revision 2.
>> + ctx->s_max = (16 << (sconf->resolution > 1)) - 1;
>> +
>
> It seems simpler to me to just do:
> ctx->s_max = sconf->resolution > 1 ? 31 : 15;
Well someone injected a little prudence about ?: into me... but ok,
revision 1 attached.
-Thilo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: als_max_rice.rev1.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100213/97d7c656/attachment.asc>
More information about the ffmpeg-devel
mailing list