[FFmpeg-cvslog] r22974 - trunk/libavcodec/iff.c

Ronald S. Bultje rsbultje
Tue Apr 27 15:52:20 CEST 2010


Hi,

On Mon, Apr 26, 2010 at 8:28 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Apr 27, 2010 at 12:37:13AM +0200, rbultje wrote:
>> Author: rbultje
>> Date: Tue Apr 27 00:37:13 2010
>> New Revision: 22974
>>
>> Log:
>> Switch some ints to unsigned (they can only have positive values, this allows
>> compiler to optimize some math from mul/div to shr/shl).

>> Also add a cast to
>> uint32_t when calling decodeplane32().
>
> and why?

Silences a compiler warning.

> and who approved this patch?

Mans and I.

[..]
> never used in >> or /

Hmk, would you like me to revert these parts? I confess that I didn't
check each individual one.

>> @@ -97,12 +98,11 @@ static av_cold int decode_init(AVCodecCo
>> ?static void decodeplane8(uint8_t *dst, const uint8_t *const buf, int buf_size, int bps, int plane)
>> ?{
>> ? ? ?GetBitContext gb;
>> - ? ?int i, b;
>> + ? ?unsigned int i;
>> + ? ?const unsigned b = (buf_size * 8) + bps - 1;
>> ? ? ?init_get_bits(&gb, buf, buf_size * 8);
>> - ? ?for(i = 0; i < (buf_size * 8 + bps - 1) / bps; i++) {
>> - ? ? ? ?for (b = 0; b < bps; b++) {
>> - ? ? ? ? ? ?dst[ i*bps + b ] |= get_bits1(&gb) << plane;
>> - ? ? ? ?}
>> + ? ?for(i = 0; i < b; i++) {
>> + ? ? ? ?dst[i] |= get_bits1(&gb) << plane;
>> ? ? ?}
>> ?}
>
> unrelated change
>
>
>>
>> @@ -117,12 +117,11 @@ static void decodeplane8(uint8_t *dst, c
>> ?static void decodeplane32(uint32_t *dst, const uint8_t *const buf, int buf_size, int bps, int plane)
>> ?{
>> ? ? ?GetBitContext gb;
>> - ? ?int i, b;
>> + ? ?unsigned i;
>> + ? ?const unsigned b = (buf_size * 8) + bps - 1;
>> ? ? ?init_get_bits(&gb, buf, buf_size * 8);
>> - ? ?for(i = 0; i < (buf_size * 8 + bps - 1) / bps; i++) {
>> - ? ? ? ?for (b = 0; b < bps; b++) {
>> - ? ? ? ? ? ?dst[ i*bps + b ] |= get_bits1(&gb) << plane;
>> - ? ? ? ?}
>> + ? ?for(i = 0; i < b; i++) {
>> + ? ? ? ?dst[i] |= get_bits1(&gb) << plane;
>> ? ? ?}
>> ?}
>
> same

Commit msg edited.

Ronald



More information about the ffmpeg-cvslog mailing list