[FFmpeg-devel] [Ffmpeg-devel] [PATCH] HD DVD subtitle decoding

Ian Caulfield ian.caulfield
Tue Jul 17 16:41:47 CEST 2007


On 17/07/07, Michael Niedermayer <michaelni at gmx.at> wrote:
>
>
> > -static int get_nibble(const uint8_t *buf, int nibble_offset)
> > +static int decode_run_2bit(GetBitContext *gb, int *color)
> >  {
> > -    return (buf[nibble_offset >> 1] >> ((1 - (nibble_offset & 1)) <<
> 2)) & 0xf;
> > +    unsigned int v;
> > +
> > +    v = get_bits(gb, 4);
> > +    if (v < 0x4) {
> > +        v = (v << 4) | get_bits(gb, 4);
> > +        if (v < 0x10) {
> > +            v = (v << 4) | get_bits(gb, 4);
> > +            if (v < 0x040) {
> > +                v = (v << 4) | get_bits(gb, 4);
> > +            }
> > +        }
> > +    }
>
> v=0;
> for(t=1; v < t && t<=0x40; t<<=2)
>     v= (v<<4) | get_bits(gb, 4);


Nice, patch updated to use your version


[...]
> > -                /* set palette */
> > +                /* set colormap */
> >                  if ((buf_size - pos) < 2)
> >                      goto fail;
> > -                palette[3] = buf[pos] >> 4;
> > -                palette[2] = buf[pos] & 0x0f;
> > -                palette[1] = buf[pos + 1] >> 4;
> > -                palette[0] = buf[pos + 1] & 0x0f;
> > +                colormap[3] = buf[pos] >> 4;
> > +                colormap[2] = buf[pos] & 0x0f;
> > +                colormap[1] = buf[pos + 1] >> 4;
> > +                colormap[0] = buf[pos + 1] & 0x0f;
> >                  pos += 2;
>
> variable renamings are cosmetic and must be in a seperate patch from
> functional changes


OK, now split into three patches:

 - colormap.patch: rename "palette" to "colormap" when it's referring to the
mapping from a 2-bit encoded color to a 4-bit index into the DVD palette
 - hd-dvdsub-newer.patch: add HD-DVD subpicture decoding
 - cosmetic.patch: reindent two lines

Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: colormap.patch
Type: text/x-diff
Size: 3262 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070717/74cf4104/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hd-dvdsub-newer.patch
Type: text/x-diff
Size: 9204 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070717/74cf4104/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cosmetic.patch
Type: text/x-diff
Size: 729 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070717/74cf4104/attachment-0002.patch>



More information about the ffmpeg-devel mailing list