[Ffmpeg-devel] I'm giving up

Michael Niedermayer michaelni
Thu Dec 7 19:06:53 CET 2006


Hi

On Thu, Dec 07, 2006 at 05:14:16PM +0100, Panagiotis Issaris wrote:
> Hi Michael,
> 
> On Wed, 2006-12-06 at 15:25 +0100, Michael Niedermayer wrote:
> >[...]
> > > +static uint8_t *h264_write_nal_unit(int nal_ref_idc, int nal_unit_type, uint8_t *dest, int *destsize,
> > > +                          PutBitContext *b2)
> > > +{
> > > +    PutBitContext b;
> > > +    int i, destpos, rbsplen, escape_count;
> > > +    uint8_t *rbsp;
> > > +
> > > +    // Align b2 on a byte boundary
> > > +
> > > +    align_put_bits(b2);
> > 
> > is the rbsp trailing stuff correct? shouldnt there be a put_bits(1,1) ?
> Yes, but we had the put_bits(1,1) call in the calling context. For
> end-of-stream NAL units, the rbsp should be empty, so in that case we
> did not add the stopbit.
> 
> How about something like this? (Tested and works, but the reference
> decoder also decodes it if the extra bit is there.)

iam fine with any solution as long as it conforms to the h.264 spec

[...]

> > [...]
> > > +static void h264_dct_c(DCTELEM block[4][4])
> > > +{
> > > +    DCTELEM pieces[4][4];
> > > +
> > > +    pieces[0][0] = block[0][0]+block[1][0]+block[2][0]+block[3][0];
> > > +    pieces[0][1] = block[0][1]+block[1][1]+block[2][1]+block[3][1];
> > > +    pieces[0][2] = block[0][2]+block[1][2]+block[2][2]+block[3][2];
> > > +    pieces[0][3] = block[0][3]+block[1][3]+block[2][3]+block[3][3];
> > > +
> > > +    pieces[1][0] = (block[0][0]<<1)+block[1][0]-block[2][0]-(block[3][0]<<1);
> > > +    pieces[1][1] = (block[0][1]<<1)+block[1][1]-block[2][1]-(block[3][1]<<1);
> > > +    pieces[1][2] = (block[0][2]<<1)+block[1][2]-block[2][2]-(block[3][2]<<1);
> > > +    pieces[1][3] = (block[0][3]<<1)+block[1][3]-block[2][3]-(block[3][3]<<1);
> > > +
> > > +    pieces[2][0] = block[0][0]-block[1][0]-block[2][0]+block[3][0];
> > > +    pieces[2][1] = block[0][1]-block[1][1]-block[2][1]+block[3][1];
> > > +    pieces[2][2] = block[0][2]-block[1][2]-block[2][2]+block[3][2];
> > > +    pieces[2][3] = block[0][3]-block[1][3]-block[2][3]+block[3][3];
> > > +
> > > +    pieces[3][0] = block[0][0]-(block[1][0]<<1)+(block[2][0]<<1)-block[3][0];
> > > +    pieces[3][1] = block[0][1]-(block[1][1]<<1)+(block[2][1]<<1)-block[3][1];
> > > +    pieces[3][2] = block[0][2]-(block[1][2]<<1)+(block[2][2]<<1)-block[3][2];
> > > +    pieces[3][3] = block[0][3]-(block[1][3]<<1)+(block[2][3]<<1)-block[3][3];
> > > +
> > > +    block[0][0] = pieces[0][0]+pieces[0][1]+pieces[0][2]+pieces[0][3];
> > > +    block[0][1] = pieces[1][0]+pieces[1][1]+pieces[1][2]+pieces[1][3];
> > > +    block[0][2] = pieces[2][0]+pieces[2][1]+pieces[2][2]+pieces[2][3];
> > > +    block[0][3] = pieces[3][0]+pieces[3][1]+pieces[3][2]+pieces[3][3];
> > > +
> > > +    block[1][0] = (pieces[0][0] << 1)+pieces[0][1]-pieces[0][2]-(pieces[0][3]<<1);
> > > +    block[1][1] = (pieces[1][0] << 1)+pieces[1][1]-pieces[1][2]-(pieces[1][3]<<1);
> > > +    block[1][2] = (pieces[2][0] << 1)+pieces[2][1]-pieces[2][2]-(pieces[2][3]<<1);
> > > +    block[1][3] = (pieces[3][0] << 1)+pieces[3][1]-pieces[3][2]-(pieces[3][3]<<1);
> > > +
> > > +    block[2][0] = pieces[0][0]-pieces[0][1]-pieces[0][2]+pieces[0][3];
> > > +    block[2][1] = pieces[1][0]-pieces[1][1]-pieces[1][2]+pieces[1][3];
> > > +    block[2][2] = pieces[2][0]-pieces[2][1]-pieces[2][2]+pieces[2][3];
> > > +    block[2][3] = pieces[3][0]-pieces[3][1]-pieces[3][2]+pieces[3][3];
> > > +
> > > +    block[3][0] = pieces[0][0]-(pieces[0][1]<<1)+(pieces[0][2]<<1)-pieces[0][3];
> > > +    block[3][1] = pieces[1][0]-(pieces[1][1]<<1)+(pieces[1][2]<<1)-pieces[1][3];
> > > +    block[3][2] = pieces[2][0]-(pieces[2][1]<<1)+(pieces[2][2]<<1)-pieces[2][3];
> > > +    block[3][3] = pieces[3][0]-(pieces[3][1]<<1)+(pieces[3][2]<<1)-pieces[3][3];
> > 
> > theres are alot of redundant operations in the above, these should be
> > simplified
> I haven't spotted the redundant operations yet, but I'll go over them
> tomorrow (or this evening).

pieces[0][0] = block[0][0]+block[1][0]+block[2][0]+block[3][0];
pieces[1][0] = (block[0][0]<<1)+block[1][0]-block[2][0]-(block[3][0]<<1);
pieces[2][0] = block[0][0]-block[1][0]-block[2][0]+block[3][0];
pieces[3][0] = block[0][0]-(block[1][0]<<1)+(block[2][0]<<1)-block[3][0];

vs .

A = block[0][0]+block[3][0];
C = block[0][0]-block[3][0];
B = block[1][0]+block[2][0];
D = block[1][0]-block[2][0];
pieces[0][0] = A+B;
pieces[2][0] = A-B;
pieces[1][0] = (C<<1)+ D;
pieces[3][0] =  C    -(D<<1);


> 
> 
> > [...]
> > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > > index 03c1ae4..ac369eb 100644
> > > --- a/libavcodec/Makefile
> > > +++ b/libavcodec/Makefile
> > > @@ -86,6 +86,7 @@ OBJS-$(CONFIG_GIF_ENCODER)             +
> > >  OBJS-$(CONFIG_H261_DECODER)            += h261.o
> > >  OBJS-$(CONFIG_H261_ENCODER)            += h261.o
> > >  OBJS-$(CONFIG_H264_DECODER)            += h264.o
> > > +OBJS-$(CONFIG_H264_ENCODER)            += h264enc.o h264cavlc.o h264dsp.o
> > >  OBJS-$(CONFIG_HUFFYUV_DECODER)         += huffyuv.o
> > >  OBJS-$(CONFIG_HUFFYUV_ENCODER)         += huffyuv.o
> > >  OBJS-$(CONFIG_IDCIN_DECODER)           += idcinvideo.o
> > 
> > this can be commited if it does not break compilation
> By adding a stub for h264cavlc.c or by disabling compilation by default?

by waiting until h264cavlc.c is in svn IMHO


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you really think that XML is the answer, then you definitly missunderstood
the question -- Attila Kinali




More information about the ffmpeg-devel mailing list