[FFmpeg-devel] [PATCH] V210 decoder and encoder
Reimar Döffinger
Reimar.Doeffinger
Mon May 11 22:59:50 CEST 2009
On Mon, May 11, 2009 at 12:35:49PM -0700, Baptiste Coudurier wrote:
> On 5/11/2009 12:27 PM, Reimar D?ffinger wrote:
> >> + *udst++ = (v & 0x3FF) << 6;
> >> + *ydst++ = (v & 0xFFC00) >> 4;
> >> + *vdst++ = (v & 0x3FF00000) >> 14;
> >
> > Both
> >
> >> + *udst++ = (v & 0x000003FF) << 6;
> >> + *ydst++ = (v & 0x000FFC00) >> 4;
> >> + *vdst++ = (v & 0x3FF00000) >> 14;
> >
> > and
> >
> >> + *udst++ = (v << 6) & 0xFFC0;
> >> + *ydst++ = (v >> 4) & 0xFFC0;
> >> + *vdst++ = (v >> 14) & 0xFFC0;
> >
> > Seem nicer to me.
>
> I don't get what you mean.
That I consider both alternatives more readable.
> > I think the later one might have a speed advantage due to needing only one
> > constant.
> > Also like in the encoder you don't really need one of the ands.
>
> You mean ydst >> 14 ? What if the 2 bits are not zero ? Doesn't the bit
> gets replicated ?
No, the << 6 one, Upper bits are dropped because udst is only 16 bits, lower
bits 0 is shifted in. Thus the & is pointless.
More information about the ffmpeg-devel
mailing list