[FFmpeg-devel] [PATCH] ppm rgb48 support

Michael Niedermayer michaelni
Fri Feb 20 15:24:42 CET 2009


On Sat, Feb 21, 2009 at 12:01:17AM +1100, Peter Ross wrote:
> Enclosed with imgconvert2 rgb48[bl]e support.

all additions to imgconvert are rejected
its marked as deprecated and will be removed


[...]

> Nb: RGB48 support for swscaler was posted some time ago.
> http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-May/029784.html

IIRC there where comments and the issues where never fixed
besides your imgconvert code seems to have the same issues, so even if
its wasnt all deprecated it still would need the same fixes as the swscaler
code

anyway, some hunks are ok from your patch, feel free to apply them

> 
> -- Peter
> (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)

> Index: libavutil/avutil.h
> ===================================================================
> --- libavutil/avutil.h	(revision 17469)
> +++ libavutil/avutil.h	(working copy)
> @@ -130,6 +130,8 @@
>      PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
>      PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
>      PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
> +    PIX_FMT_RGB48BE,   ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, big-endian
> +    PIX_FMT_RGB48LE,   ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, little-endian
>      PIX_FMT_NB,        ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
>  };

hunk ok
but this also needs a #define based PIX_FMT_RGB48 that is native endian
for easy access in optimized code


>  
> Index: libavcodec/imgconvert.c
> ===================================================================
> --- libavcodec/imgconvert.c	(revision 17469)
> +++ libavcodec/imgconvert.c	(working copy)
[...]
> @@ -199,6 +200,22 @@
>          .depth = 8,
>          .x_chroma_shift = 0, .y_chroma_shift = 0,
>      },
> +    [PIX_FMT_RGB48BE] = {
> +        .name = "rgb48be",
> +        .nb_channels = 3,
> +        .color_type = FF_COLOR_RGB,
> +        .pixel_type = FF_PIXEL_PACKED,
> +        .depth = 16,
> +        .x_chroma_shift = 0, .y_chroma_shift = 0,
> +    },
> +    [PIX_FMT_RGB48LE] = {
> +        .name = "rgb48le",
> +        .nb_channels = 3,
> +        .color_type = FF_COLOR_RGB,
> +        .pixel_type = FF_PIXEL_PACKED,
> +        .depth = 16,
> +        .x_chroma_shift = 0, .y_chroma_shift = 0,
> +    },
>      [PIX_FMT_RGB565] = {
>          .name = "rgb565",
>          .nb_channels = 3,

hunk ok


> @@ -529,6 +546,10 @@
>      case PIX_FMT_BGR32_1:
>          picture->linesize[0] = width * 4;
>          break;
> +    case PIX_FMT_RGB48BE:
> +    case PIX_FMT_RGB48LE:
> +        picture->linesize[0] = width * 6;
> +        break;
>      case PIX_FMT_GRAY16BE:
>      case PIX_FMT_GRAY16LE:
>      case PIX_FMT_BGR555:

hunk ok

and the ffmpeg.c hunk belongs in a seperate patch and the +200 and *6 are also
seperate issues


[...]


> Index: libavcodec/pnm.c
> ===================================================================
> --- libavcodec/pnm.c	(revision 17469)
> +++ libavcodec/pnm.c	(working copy)
> @@ -138,8 +138,11 @@
>                  avctx->pix_fmt = PIX_FMT_GRAY16BE;
>                  if (s->maxval != 65535)
>                      avctx->pix_fmt = PIX_FMT_GRAY16;
> +            } if (avctx->pix_fmt == PIX_FMT_RGB24) {
> +                if (s->maxval > 255)
> +                    avctx->pix_fmt = PIX_FMT_RGB48BE;
>              } else {
> -                av_log(avctx, AV_LOG_ERROR, "16-bit components are only supported for grayscale\n");
> +                av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n");
>                  avctx->pix_fmt = PIX_FMT_NONE;
>                  return -1;
>              }
> Index: libavcodec/pnmenc.c
> ===================================================================
> --- libavcodec/pnmenc.c	(revision 17469)
> +++ libavcodec/pnmenc.c	(working copy)
> @@ -63,6 +63,9 @@
>      switch(avctx->pix_fmt) {
>      default:
>          return -1;
> +    case PIX_FMT_RGB48BE:
> +        n = avctx->width * 6;
> +        goto do_read;
>      case PIX_FMT_RGB24:
>          n = avctx->width * 3;
>          goto do_read;
> @@ -195,6 +198,10 @@
>          c = '6';
>          n = avctx->width * 3;
>          break;
> +    case PIX_FMT_RGB48BE:
> +        c = '6';
> +        n = avctx->width * 6;
> +        break;
>      case PIX_FMT_YUV420P:
>          c = '5';
>          n = avctx->width;
> @@ -209,7 +216,7 @@
>      s->bytestream += strlen(s->bytestream);
>      if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
>          snprintf(s->bytestream, s->bytestream_end - s->bytestream,
> -                 "%d\n", (avctx->pix_fmt != PIX_FMT_GRAY16BE) ? 255 : 65535);
> +                 "%d\n", (avctx->pix_fmt != PIX_FMT_GRAY16BE && avctx->pix_fmt != PIX_FMT_RGB48BE) ? 255 : 65535);
>          s->bytestream += strlen(s->bytestream);
>      }
>  
> @@ -394,7 +401,7 @@
>      pnm_encode_frame,
>      NULL, //encode_end,
>      pnm_decode_frame,
> -    .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_NONE},
> +    .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
>      .long_name= NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
>  };
>  #endif // CONFIG_PPM_ENCODER

pnm hunks ok

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- 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/20090220/fa2a3db0/attachment.pgp>



More information about the ffmpeg-devel mailing list