[FFmpeg-devel] Google Summer of Code participation
Thilo Borgmann
thilo.borgmann
Thu Apr 9 03:25:10 CEST 2009
Michael Niedermayer schrieb:
>
>> + int i = 0;
>> + int j = 0;
>>
>
> redudnant init
>
>
Yes, removed.
>> + int offset = 0;
>> + uint8_t *pd = s->image_buf;
>> + uint8_t *pd_last = s->last_image_buf;
>> +
>> + for(j=0; j < s->height; j++) {
>>
>
>
>> + for(i=0; i < s->image_linesize; i++) {
>>
>
> width
>
>
No. image_linesize != width. Linesize is needed here as the copy is done
byte-wise. But there are s->height of these long lines.
>
>> + pd[offset + i] = pd[offset + i] + pd_last[offset + i];
>> + }
>> + offset += (s->picture).linesize[0];
>> + }
>> + }
>> + }
>> + else {
>> + /* allocate a buffer to store the last frame if not yet done */
>> + s->last_image_buf = av_malloc(s->image_linesize * s->height);
>> + if(s->last_image_buf == NULL) av_log(avctx, AV_LOG_ERROR, "av_malloc() failed\n");
>> + }
>> +
>> + /* preserve the last decoded frame for p-frame decoding */
>> + if(s->last_image_buf != NULL)
>>
>
> trailing whitespace
>
>
Also removed.
>
>> + memcpy(s->last_image_buf, s->image_buf, s->image_linesize * s->height);
>>
>
> memcpy should not be needed for decoding
>
>
Hmm to avoid this call I think about double buffering via a second
AVFrame in the PNGContext instead of a uint8_t buffer? If you agree I
will do this tomorrow.
TB
More information about the ffmpeg-devel
mailing list