On 2/10/12, Justin Ruggles <[email protected]> wrote:
> On 02/09/2012 05:48 PM, Paul B Mahol wrote:
>
>>
>> Signed-off-by: Paul B Mahol <[email protected]>
>> ---
>>  libavcodec/wavpack.c |   52
>> ++++++++++++++++++++++++++++---------------------
>>  1 files changed, 30 insertions(+), 22 deletions(-)
>>
>> diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
>> index 1098873..e7e7da8 100644
>> --- a/libavcodec/wavpack.c
>> +++ b/libavcodec/wavpack.c
>> @@ -408,7 +408,8 @@ static inline int
>> wv_get_value_integer(WavpackFrameContext *s, uint32_t *crc,
>>
>>          if (s->got_extra_bits && get_bits_left(&s->gb_extra_bits) >=
>> s->extra_bits) {
>>              S |= get_bits(&s->gb_extra_bits, s->extra_bits);
>> -            *crc = *crc * 9 + (S & 0xffff) * 3 + ((unsigned)S >> 16);
>> +            if (s->avctx->err_recognition & AV_EF_CRCCHECK)
>> +                *crc = *crc * 9 + (S & 0xffff) * 3 + ((unsigned)S >> 16);
>>          }
>>      }
>>
>> @@ -488,7 +489,8 @@ static float wv_get_value_float(WavpackFrameContext
>> *s, uint32_t *crc, int S)
>>          }
>>      }
>>
>> -    *crc = *crc * 27 + S * 9 + exp * 3 + sign;
>> +    if (s->avctx->err_recognition & AV_EF_CRCCHECK)
>> +        *crc = *crc * 27 + S * 9 + exp * 3 + sign;
>>
>>      value.u = (sign << 31) | (exp << 23) | S;
>>      return value.f;
>> @@ -500,6 +502,24 @@ static void
>> wv_reset_saved_context(WavpackFrameContext *s)
>>      s->sc.crc = s->extra_sc.crc = 0xFFFFFFFF;
>>  }
>>
>> +static inline int wv_check_crc(WavpackFrameContext *s, uint32_t crc,
>> +                               uint32_t crc_extra_bits)
>> +{
>> +    wv_reset_saved_context(s);
>
>
> would be simpler to do:
>
> wv_reset_saved_context(s);
> if (s->avctx->err_recognition & AV_EF_CRCCHECK)
>     wv_check_crc();

That one would break crc checking.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to