[FFmpeg-devel] [PATCH] dpx: 10 and 12 bit decoding

Paul B Mahol onemda at gmail.com
Tue Aug 28 11:57:15 CEST 2012


On 8/26/12, Georg Lippitsch <georg.lippitsch at gmx.at> wrote:
> Rewrite 10 bit dpx decoder to decode into GBRP10 color space
> instead of converting to RGB48.
> Add 12 bit decoder to decode into GBRP12 color space.
> ---
>  libavcodec/dpx.c   |   87
> ++++++++++++++++++++++++++++++++++------------------
>  tests/ref/lavf/dpx |    2 +-
>  2 files changed, 58 insertions(+), 31 deletions(-)
>
> diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
> index 5e35005..71cf439 100644
> --- a/libavcodec/dpx.c
> +++ b/libavcodec/dpx.c
> @@ -41,14 +41,6 @@ static unsigned int read32(const uint8_t **ptr, int
> is_big)
>      return temp;
>  }
>
> -static inline unsigned make_16bit(unsigned value)
> -{
> -    // mask away invalid bits
> -    value &= 0xFFC0;
> -    // correctly expand to 16 bits
> -    return value + (value >> 10);
> -}
> -
>  static int decode_frame(AVCodecContext *avctx,
>                          void *data,
>                          int *data_size,
> @@ -60,12 +52,13 @@ static int decode_frame(AVCodecContext *avctx,
>      DPXContext *const s = avctx->priv_data;
>      AVFrame *picture  = data;
>      AVFrame *const p = &s->picture;
> -    uint8_t *ptr;
> +    uint8_t *ptr[AV_NUM_DATA_POINTERS];
>
>      unsigned int offset;
>      int magic_num, endian;
> -    int x, y;
> +    int x, y, i;
>      int w, h, stride, bits_per_color, descriptor, elements,
> target_packet_size, source_packet_size;
> +    int planar;
>
>      unsigned int rgbBuffer;
>
> @@ -138,13 +131,24 @@ static int decode_frame(AVCodecContext *avctx,
>              }
>              source_packet_size = elements;
>              target_packet_size = elements;
> +            planar = 0;
>              break;
>          case 10:
> -            avctx->pix_fmt = PIX_FMT_RGB48;
> +            avctx->pix_fmt = PIX_FMT_GBRP10;
>              target_packet_size = 6;
>              source_packet_size = 4;
> +            planar = 1;
>              break;
>          case 12:
> +            if (endian) {
> +                avctx->pix_fmt = elements == 4 ? PIX_FMT_GBRP12BE :
> PIX_FMT_GBRP12BE;
Huh?

> +            } else {
> +                avctx->pix_fmt = elements == 4 ? PIX_FMT_GBRP12LE :
> PIX_FMT_GBRP12LE;

ditto.

[...]


More information about the ffmpeg-devel mailing list