[FFmpeg-devel] [PATCH] 8088flex TMV demuxer and decoder

Michael Niedermayer michaelni
Thu Apr 23 19:07:12 CEST 2009


On Wed, Apr 22, 2009 at 05:51:01PM -0500, Daniel Verkamp wrote:
> On Wed, Apr 22, 2009 at 4:18 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Wed, Apr 22, 2009 at 02:33:42PM -0500, Daniel Verkamp wrote:
> >
> > [...]
> >> +static av_cold int tmv_decode_init(AVCodecContext *avctx)
> >> +{
> >> + ? ?TMVContext *tmv = avctx->priv_data;
> >> +
> >> + ? ?tmv->pic.data[0] = NULL;
> >> +
> >> + ? ?return 0;
> >> +}
> >
> > seems useless
> >
> 
> Right, priv_data is zeroed already - removed.  This was boilerplate
> stuff copied from zmbv.c; it could probably be removed from there as
> well.
[...]
> +static int tmv_decode_frame(AVCodecContext *avctx, void *data,
> +                            int *data_size, AVPacket *avpkt)
> +{
> +    TMVContext *tmv    = avctx->priv_data;
> +    const uint8_t *src = avpkt->data;
> +    uint8_t *dst, *dst_char;
> +    unsigned char_cols = avctx->width >> 3;
> +    unsigned char_rows = avctx->height >> 3;
> +    unsigned x, y, mask, char_y, fg, bg, c;
> +
> +    if (tmv->pic.data[0])
> +        avctx->release_buffer(avctx, &tmv->pic);
> +
> +    if (avctx->get_buffer(avctx, &tmv->pic) < 0) {
> +        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> +        return -1;
> +    }
> +
> +    tmv->pic.pict_type = FF_I_TYPE;
> +    tmv->pic.key_frame = 1;
> +    dst                = tmv->pic.data[0];
> +

> +    if (!tmv->pal_set) {
> +        tmv->pal_set                 = 1;
> +        tmv->pic.palette_has_changed = 1;
> +        memcpy(tmv->pic.data[1], ff_cga_palette, 16 * 4);
> +    }

i dont think you can skip setting the palette like that
Only if the buffer returned by (re)get_buffer() is identical to one where
the palette has been set already (see AVFrame->age) could it be skiped
and yes this likely is broken in existing codecs too


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is not what we do, but why we do it that matters.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090423/7da795b3/attachment.pgp>



More information about the ffmpeg-devel mailing list