[FFmpeg-devel] [PATCH] cllc: Implement YUYV support

Michael Niedermayer michaelni at gmx.at
Mon Jun 24 04:09:51 CEST 2013


On Sun, Jun 23, 2013 at 07:40:53PM -0400, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libavcodec/cllc.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 100 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c
> index 6378c79..13e35d9 100644
> --- a/libavcodec/cllc.c
> +++ b/libavcodec/cllc.c
> @@ -1,7 +1,7 @@
>  /*
>   * Canopus Lossless Codec decoder
>   *
> - * Copyright (c) 2012 Derek Buitenhuis
> + * Copyright (c) 2012-2013 Derek Buitenhuis
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -179,6 +179,40 @@ static int read_rgb24_component_line(CLLCContext *ctx, GetBitContext *gb,
>      return 0;
>  }
>  
> +static int read_yuv_component_line(CLLCContext *ctx, GetBitContext *gb,
> +                                   int *top_left, VLC *vlc, uint8_t *outbuf,
> +                                   int luma)
> +{
> +    uint8_t *dst;
> +    int pred, code;
> +    int i;
> +    int step;
> +
> +    OPEN_READER(bits, gb);
> +
> +    dst  = outbuf;
> +    pred = *top_left;
> +
> +    step = luma ? 4 : 2;
> +
> +    /* Simultaneously read and restore the line */
> +    for (i = 0; i < ctx->avctx->width / (step / 2); i++) {
> +        UPDATE_CACHE(bits, gb);
> +        GET_VLC(code, bits, gb, vlc->table, 7, 2);
> +
> +        pred  += code;
> +        dst[0] = pred;
> +        dst   += step;
> +    }
> +
> +    CLOSE_READER(bits, gb);
> +
> +    /* Stash the first pixel */
> +    *top_left = dst[-2 * ctx->avctx->width];
> +
> +    return 0;
> +}

does this codec need any width % 2 != 0 or width > 1 check ?

LGTM otherwise

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130624/f7232f27/attachment.asc>


More information about the ffmpeg-devel mailing list