Browse code

lavc/dpx: Support decoding 10 bit colourspace with transparency information.

Fixes one sample from ticket #5639.

Carl Eugen Hoyos authored on 2016/06/15 00:02:34
Showing 1 changed files
... ...
@@ -256,11 +256,13 @@ static int decode_frame(AVCodecContext *avctx,
256 256
         avctx->pix_fmt = AV_PIX_FMT_RGBA;
257 257
         break;
258 258
     case 50100:
259
-    case 51100:
260 259
     case 50101:
261
-    case 51101:
262 260
         avctx->pix_fmt = AV_PIX_FMT_GBRP10;
263 261
         break;
262
+    case 51100:
263
+    case 51101:
264
+        avctx->pix_fmt = AV_PIX_FMT_GBRAP10;
265
+        break;
264 266
     case 50120:
265 267
     case 51120:
266 268
     case 50121:
... ...
@@ -313,9 +315,10 @@ static int decode_frame(AVCodecContext *avctx,
313 313
     switch (bits_per_color) {
314 314
     case 10:
315 315
         for (x = 0; x < avctx->height; x++) {
316
-            uint16_t *dst[3] = {(uint16_t*)ptr[0],
316
+            uint16_t *dst[4] = {(uint16_t*)ptr[0],
317 317
                                 (uint16_t*)ptr[1],
318
-                                (uint16_t*)ptr[2]};
318
+                                (uint16_t*)ptr[2],
319
+                                (uint16_t*)ptr[3]};
319 320
             for (y = 0; y < avctx->width; y++) {
320 321
                 *dst[2]++ = read10in32(&buf, &rgbBuffer,
321 322
                                        &n_datum, endian);
... ...
@@ -323,13 +326,13 @@ static int decode_frame(AVCodecContext *avctx,
323 323
                                        &n_datum, endian);
324 324
                 *dst[1]++ = read10in32(&buf, &rgbBuffer,
325 325
                                        &n_datum, endian);
326
-                // For 10 bit, ignore alpha
327 326
                 if (elements == 4)
327
+                    *dst[3]++ =
328 328
                     read10in32(&buf, &rgbBuffer,
329 329
                                &n_datum, endian);
330 330
             }
331 331
             n_datum = 0;
332
-            for (i = 0; i < 3; i++)
332
+            for (i = 0; i < elements; i++)
333 333
                 ptr[i] += p->linesize[i];
334 334
         }
335 335
         break;