[FFmpeg-devel] [PATCH]Support encoding RGB48 with libopenjpeg

Michael Bradshaw mbradshaw at sorensonmedia.com
Wed Jan 11 19:49:48 CET 2012


@@ -207,6 +212,33 @@ static int libopenjpeg_copy_rgba(AVCodecContext
*avctx, AVFrame *frame, opj_imag
     return 1;
 }

+static int libopenjpeg_copy_rgb16(AVCodecContext *avctx, AVFrame *frame,
opj_image_t *image, int numcomps)
+{
+    int compno;
+    int x;
+    int y;
+    uint16_t *frame_ptr;
+
+    av_assert0(numcomps == 3);
+
+    for (compno = 0; compno < numcomps; ++compno) {
+        if (image->comps[compno].w > frame->linesize[0] / numcomps) {
+            return 0;
+        }
+    }
+
+    for (compno = 0; compno < numcomps; ++compno) {
+        frame_ptr = (uint16_t*)frame->data[0];

This line should probably be outside of the loop, seeing as frame_ptr gets
set to the same value each loop.  Everything else looks good though.

Thanks!

Michael


More information about the ffmpeg-devel mailing list