[FFmpeg-devel] [PATCH] smc: simplify color_flags reading

Michael Niedermayer michaelni
Sun Aug 16 01:16:50 CEST 2009


On Sat, Aug 15, 2009 at 01:08:13PM +0200, Reimar D?ffinger wrote:
> Hello,
> removes a useless = 0 initialization and uses AV_RB16 where possible.
> Index: libavcodec/smc.c
> ===================================================================
> --- libavcodec/smc.c    (revision 19646)
> +++ libavcodec/smc.c    (working copy)
> @@ -366,16 +366,11 @@
>                      flags_a = xx012456, flags_b = xx89A37B
>                  */
>                  /* build the color flags */
> -                color_flags_a = color_flags_b = 0;
>                  color_flags_a =
> -                    (s->buf[stream_ptr + 0] << 16) |
> -                    ((s->buf[stream_ptr + 1] & 0xF0) << 8) |
> -                    ((s->buf[stream_ptr + 2] & 0xF0) << 4) |
> -                    ((s->buf[stream_ptr + 2] & 0x0F) << 4) |
> -                    ((s->buf[stream_ptr + 3] & 0xF0) >> 4);
> +                    ((AV_RB16(s->buf + stream_ptr    ) & 0xFFF0) << 8)
> |
> +                     (AV_RB16(s->buf + stream_ptr + 2) >> 4);
>                  color_flags_b =
> -                    (s->buf[stream_ptr + 4] << 16) |
> -                    ((s->buf[stream_ptr + 5] & 0xF0) << 8) |
> +                    ((AV_RB16(s->buf + stream_ptr + 4) & 0xFFF0) << 8)
> |

i suggest you dont place the | in the first column ;)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090816/fbcc220c/attachment.pgp>



More information about the ffmpeg-devel mailing list