[FFmpeg-devel] Google Summer of Code participation

Thilo Borgmann thilo.borgmann
Thu Apr 9 16:59:38 CEST 2009



Michael Niedermayer schrieb:
>
>> @@ -377,6 +378,13 @@ static int png_decode_idat(PNGDecContext *s, int length)
>>      return 0;
>>  }
>>  
>> +static void png_flip_pictures(PNGDecContext *s)
>> +{
>> +    AVFrame *dummy = s->current_picture;
>> +    s->current_picture = s->last_picture;
>> +    s->last_picture = dummy;
>> +}
>> +
>>     
>
> FFSWAP
>
>   
Ok.
>> +                for(i=0; i < s->width; i++) {
>> +                    pd[offset + 0 + i*3] = pd[offset + 0 + i*3] + pd_last[offset + 0 + i*3];
>> +                    pd[offset + 1 + i*3] = pd[offset + 1 + i*3] + pd_last[offset + 1 + i*3];
>> +                    pd[offset + 2 + i*3] = pd[offset + 2 + i*3] + pd_last[offset + 2 + i*3];
>> +                }
>>     
>
> for(j=0; j<width*3; j++)
>
>   
Hm. But what about the bits per pixel problem?
If you want width there, then I propose:

for(j=0; j<width*s->bpp; j++)

Which is fail safe if s->bit_depth != 8.
If you realy want width*3 then there has to be something I don't 
understand. If that's the case, please tell me why "3" will always work...
>> @@ -602,8 +632,10 @@ static int decode_frame(AVCodecContext *avctx,
>>  static av_cold int png_dec_init(AVCodecContext *avctx){
>>      PNGDecContext *s = avctx->priv_data;
>>  
>> -    avcodec_get_frame_defaults(&s->picture);
>> -    avctx->coded_frame= &s->picture;
>> +    s->current_picture = &s->picture1;
>> +    s->last_picture = &s->picture2;
>> +    avcodec_get_frame_defaults(&s->picture1);
>>     
>
>   
>> +    avctx->coded_frame= &s->picture1;
>>     
>
> this is wrong
>
>   
I carried it over from the original code. Although it can be deleted 
completely, it might be set "avctx->coded_frame = &s->picture2" to 
respect the initial flip in decode frame and thus keep close to the 
original. If not, what is wrong?

TB



More information about the ffmpeg-devel mailing list