aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>2018-06-16 17:47:46 +0200
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2018-06-21 17:41:48 +0200
commit061e326b60ea89bd93df5bfe618283d6d411708d (patch)
treec38e435f9366b7d12492097f00307590b89c7884
parentaf1e70dd664e874d855e862fa7a05766a22b55ee (diff)
downloadffmpeg-061e326b60ea89bd93df5bfe618283d6d411708d.tar.gz
lavc/dpx: Support 10-bit packing method b (msbpad).
-rw-r--r--libavcodec/dpx.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index a781d8a40d..f75e2cbbca 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -51,7 +51,7 @@ static unsigned int read32(const uint8_t **ptr, int is_big)
}
static uint16_t read10in32(const uint8_t **ptr, uint32_t * lbuf,
- int * n_datum, int is_big)
+ int * n_datum, int is_big, int shift)
{
if (*n_datum)
(*n_datum)--;
@@ -60,7 +60,7 @@ static uint16_t read10in32(const uint8_t **ptr, uint32_t * lbuf,
*n_datum = 2;
}
- *lbuf = (*lbuf << 10) | (*lbuf >> 22);
+ *lbuf = *lbuf << 10 | *lbuf >> shift & 0x3FFFFF;
return *lbuf & 0x3FF;
}
@@ -221,7 +221,7 @@ static int decode_frame(AVCodecContext *avctx,
stride = avctx->width * elements;
break;
case 10:
- if (!packing || packing > 1) {
+ if (!packing) {
av_log(avctx, AV_LOG_ERROR, "Packing to 32bit required\n");
return -1;
}
@@ -360,17 +360,18 @@ static int decode_frame(AVCodecContext *avctx,
(uint16_t*)ptr[1],
(uint16_t*)ptr[2],
(uint16_t*)ptr[3]};
+ int shift = packing == 1 ? 22 : 20;
for (y = 0; y < avctx->width; y++) {
*dst[2]++ = read10in32(&buf, &rgbBuffer,
- &n_datum, endian);
+ &n_datum, endian, shift);
*dst[0]++ = read10in32(&buf, &rgbBuffer,
- &n_datum, endian);
+ &n_datum, endian, shift);
*dst[1]++ = read10in32(&buf, &rgbBuffer,
- &n_datum, endian);
+ &n_datum, endian, shift);
if (elements == 4)
*dst[3]++ =
read10in32(&buf, &rgbBuffer,
- &n_datum, endian);
+ &n_datum, endian, shift);
}
n_datum = 0;
for (i = 0; i < elements; i++)