[FFmpeg-devel] [RFC] WC3 decoder without AVPaletteControl

Reimar Döffinger Reimar.Doeffinger
Sat Nov 20 11:01:29 CET 2010


On Sat, Nov 20, 2010 at 05:16:49AM +0100, Michael Niedermayer wrote:
> On Thu, Nov 18, 2010 at 10:18:08PM +0100, Reimar D?ffinger wrote:
> > > > > > Index: libavformat/utils.c
> > > > > > ===================================================================
> > > > > > --- libavformat/utils.c	(revision 18467)
> > > > > > +++ libavformat/utils.c	(working copy)
> > > > > > @@ -277,6 +277,20 @@
> > > > > >      return ret;
> > > > > >  }
> > > > > >  
> > > > > > +int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size)
> > > > > > +{
> > > > > > +    int ret;
> > > > > > +    int old_size;
> > > > > > +    if (!pkt->size)
> > > > > > +        return av_get_packet(s, pkt, size);
> > > > > > +    old_size = pkt->size;
> > > > > > +    ret = av_grow_packet(pkt, size);
> > > > > 
> > > > > isnt av_grow_packet already checking for pkt->size==0 ?
> > > > 
> > > > Yes, but it only allocates a new packet then. av_get_packet also sets
> > > > pkt->pos. Sure, maybe a bit overkill for a single assignment, just
> > > > thought it might be more future-proof.
> > > 
> > > well, fine leave that then
> > 
> > One more try...
> 
> is it intended to change the table to dynmically generated in this patch?
> is the code even smaller than the 256 bytes?

No, this is actually only meant as documentation.
I'll add that in a separate patch and keep the table by default.

> > 9a9e24da63ec55a4343383c70e733205f50f2f9c  wc3_pal.diff
> > Index: libavcodec/avcodec.h
> > ===================================================================
> > --- libavcodec/avcodec.h	(revision 25765)
> > +++ libavcodec/avcodec.h	(working copy)
> > @@ -3027,6 +3027,14 @@
> >  void av_shrink_packet(AVPacket *pkt, int size);
> >  
> >  /**
> > + * Increase packet size, correctly zeroing padding
> > + *
> > + * @param pkt packet
> > + * @param grow_by number of bytes by which to increase the size of the packet
> > + */
> > +int av_grow_packet(AVPacket *pkt, int grow_by);
> 
> maybe this should be size_t

Well, av_new_packet uses int as well, so that would be inconsistent IMO.
And I still don't like the idea of code that behaves differently
on different architectures.
Oh, and in case someone wants to test it, this file:
http://samples.mplayerhq.hu/game-formats/wc3-mve/wc3-successful-mission.mve
after the patch plays correctly in ffplay, before it broke for a short
time during a palette change.
Update patch attached, it also contains a change to SHOT_TAG handling
so that an invalid value there does not cause the palette plane to
be uninitialized.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wc3_pal.diff
Type: text/x-diff
Size: 16309 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101120/9888a128/attachment.diff>



More information about the ffmpeg-devel mailing list