On 2013-02-16 14:54:18 +0100, Anton Khirnov wrote: > > On Fri, 15 Feb 2013 14:43:57 +0100, Janne Grunau <[email protected]> > wrote: > > On 2013-01-08 15:37:38 +0100, Anton Khirnov wrote: > > > Additionally switch to get_bufer() and enable DR1. > > > > > @@ -292,46 +285,46 @@ static int tgv_decode_frame(AVCodecContext *avctx, > > > if ((ret = av_image_check_size(s->width, s->height, 0, avctx)) < 0) > > > return ret; > > > > > > - /* shuffle */ > > > - FFSWAP(AVFrame, s->frame, s->last_frame); > > > - if (!s->frame.data[0]) { > > > - s->frame.reference = 1; > > > - s->frame.buffer_hints = FF_BUFFER_HINTS_VALID; > > > - s->frame.linesize[0] = s->width; > > > + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) > > > + return ret; > > > > > > - s->frame.data[0] = av_malloc(s->width * s->height); > > > - if (!s->frame.data[0]) > > > - return AVERROR(ENOMEM); > > > - s->frame.data[1] = av_malloc(AVPALETTE_SIZE); > > > - if (!s->frame.data[1]) { > > > - av_freep(&s->frame.data[0]); > > > - return AVERROR(ENOMEM); > > > - } > > > - } > > > - memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); > > > + memcpy(frame->data[1], s->palette, AVPALETTE_SIZE); > > > > > > if (chunk_type == kVGT_TAG) { > > > - s->frame.key_frame = 1; > > > - s->frame.pict_type = AV_PICTURE_TYPE_I; > > > - if (unpack(buf, buf_end, s->frame.data[0], s->avctx->width, > > > s->avctx->height) < 0) { > > > + int y; > > > + frame->key_frame = 1; > > > + frame->pict_type = AV_PICTURE_TYPE_I; > > > + > > > + if (!s->frame_buffer && > > > + !(s->frame_buffer = av_malloc(s->width * s->height))) > > > + return AVERROR(ENOMEM); > > > + > > > + if (unpack(buf, buf_end, s->frame_buffer, s->avctx->width, > > > s->avctx->height) < 0) { > > > av_log(avctx, AV_LOG_WARNING, "truncated intra frame\n"); > > > return AVERROR_INVALIDDATA; > > > } > > > + for (y = 0; y < s->height; y++) > > > + memcpy(frame->data[0] + y * frame->linesize[0], > > > + s->frame_buffer + y * s->width, > > > + s->width); > > > > I guess there is no way to guarantee that get_buffer2() returns a frame > > without edges. Although I'm suspect we already have decoders depending > > on it. The seperate buffer and memcpy is ugly and direct rendering is a > > lie. > > > > I don't disagree, but Kostya preferred this solution to manually allocating > the > AVBuffers and constructing the frame from them. I guess for such an obscure > decoder it does not really matter.
ok Janne _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
