Message ID | e8afa2d1-1d07-4553-ad4c-a0c77d2dbb7a@mediaarea.net |
---|---|
State | Accepted |
Commit | 5205b3289e46b680c314e44a9243929b6d00146a |
Headers | show |
On 6/1/18, Jerome Martinez <jerome@mediaarea.net> wrote: > 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 > applied.
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;