[FFmpeg-soc] [soc]: r3871 - dirac/libavcodec/diracdec.c
David Conrad
lessen42 at gmail.com
Tue Dec 9 23:06:03 CET 2008
On Dec 6, 2008, at 6:21 AM, Michael Niedermayer wrote:
> On Sat, Dec 06, 2008 at 03:01:00AM +0100, conrad wrote:
>> Author: conrad
>> Date: Sat Dec 6 03:00:59 2008
>> New Revision: 3871
>>
>> Log:
>> Small optimization
>>
>>
>> Modified:
>> dirac/libavcodec/diracdec.c
>>
>> Modified: dirac/libavcodec/diracdec.c
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- dirac/libavcodec/diracdec.c (original)
>> +++ dirac/libavcodec/diracdec.c Sat Dec 6 03:00:59 2008
>> @@ -664,9 +664,9 @@ static int dirac_decode_frame_internal(D
>> mcline = s->mcpic;
>> for (y = 0; y < height; y++) {
>> for (x = 0; x < width; x++) {
>> + int coeff = mcline[x] + (1 << (s-
>> >total_wt_bits - 1));
>> + coeff = line[x] + (coeff >> s->total_wt_bits);
>> + frame[x]= av_clip_uint8(coeff + 128);
>> }
>
> depending on how large total_wt_bits can be, the following might be
> possible
>
> bias= 257 << (s->total_wt_bits - 1);
> for (y = 0; y < height; y++) {
> for (x = 0; x < width; x++) {
> int coeff = mcline[x] + bias;
> coeff = line[x] + (coeff >> s->total_wt_bits);
> frame[x]= av_clip_uint8(coeff);
> }
> }
I don't think the spec limits how large total_wt_bits can be, but
commonly it's not more than 7 and can't exceed 22 without using
macroblocks with width or height greater than 1023, so this should be
safe for sane files.
More information about the FFmpeg-soc
mailing list