[FFmpeg-devel] [Ffmpeg-devel] [PATCH] HD DVD subtitle decoding
Michael Niedermayer
michaelni
Tue Jul 17 13:55:45 CEST 2007
Hi
On Mon, Jul 16, 2007 at 02:48:40PM +0100, Ian Caulfield wrote:
> Finally had a chance to catch up on this...
>
> On 19/02/07, Michael Niedermayer <michaelni at gmx.at> wrote:
> >
> >Hi
> >
> >On Mon, Feb 19, 2007 at 10:48:35AM +0000, Ian Caulfield wrote:
> >> On 18/02/07, Michael Niedermayer <michaelni at gmx.at> wrote:
> >> >Hi
> >> >iam more in favor of putting the YUV_TO_RGB*_CCIR into a header and
> >> >including this
> >> >what the function above does seems quite specific to dvdsubdec.c
> >> >so IMHO it should be there rather
> >>
> >> I think dvbsubdec does a yuv->rgb conversion in more or less the same
> >> way. I'll move the code over to a separate header (colorspace.h?)
> >
> >if you keep the loop in dvdsubdec.c then moving YUV_TO_RGB*_CCIR to
> >colorspace.h sounds like a good idea
>
>
> colorspace.patch moves these defines to colorspace.h (via an svn cp from
> imgconvert.c), and removes the copied code from dvbsub.c and dvbsubdec.c.
ok
>
> hd-dvdsub-new.patch is the updated version of the HD-DVD subtitle patch,
> using the new colorspace include.
[...]
> -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);
[...]
> - /* 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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070717/ce3a8a56/attachment.pgp>
More information about the ffmpeg-devel
mailing list