On 08/02/2018 11:28, Jerome Martinez wrote:
Currently RGB and RGBA 12-bit are supported by DPX decoder only if component values are padded (packing "Filled to 32-bit words, method A"). This patch adds decoding of RGB and RGBA 12-bit with no padding (packing "Packed into 32-bit words").

As I have no file with line boundaries not aligned on 32-bit, I can not have good tests about the stride computing (so code about non aligned boundaries is theory) so I preferred to limit risks by decoding only if line boundaries are aligned on 32-bit words: - 8 pixels for RGB (8 pixels x 3 components x 12 bits = 288 bits = 9 x 32-bit words) - 2 pixels for RGBA (2 pixels x 4 components x 12 bits = 3 x 32-bit words)

I think Little Endian parsing is fine thanks to the generic code about Big vs Little endian but I have no Little Endian test file so I also limited the decoding to Big Endian files.

Would be happy to check with cases I was not able to check if someone provides files.


Since the email, RGB 12-bit packed decoding was pushed.
Attached is the patch for RGBA 12-bit packed decoding, rebased.

Test file:
https://trac.ffmpeg.org/attachment/ticket/5639/12bit_a.dpx
From b22c71ed0d81bce8a0a0116052970f8a9bcc9008 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Martinez?= <jer...@mediaarea.net>
Date: Fri, 1 Jun 2018 10:09:01 +0200
Subject: [PATCH] avcodec/dpx: Support for RGBA 12-bit packed decoding

Limited to widths multiple of 2 due to lack of test files for such corner case

This partially fixes ticket #5639
---
 libavcodec/dpx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index 026fb10e90..fb388b6e52 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -237,6 +237,9 @@ static int decode_frame(AVCodecContext *avctx,
             if (descriptor == 50 && endian && (avctx->width%8) == 0) { // 
Little endian and widths not a multiple of 8 need tests
                 tested = 1;
             }
+            if (descriptor == 51 && endian && (avctx->width%2) == 0) { // 
Little endian and widths not a multiple of 2 need tests
+                tested = 1;
+            }
             if (!tested) {
                 av_log(avctx, AV_LOG_ERROR, "Packing to 16bit required\n");
                 return -1;
-- 
2.13.3.windows.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to