[FFmpeg-devel] lavc/dpx: Reset n_datum for every line when decoding 12bit.

Submitted by Carl Eugen Hoyos on June 13, 2018, 12:24 p.m.

Details

Message ID CAB0OVGpf_syRyi8Dt59pmDZCaJXqr2vQ43duNyZ49R+cqFSWCw@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos June 13, 2018, 12:24 p.m.
Hi!

Attached patch fixes decoding of two files (width 999) that Piotr
kindly provided, uploaded to
http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket5639/

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos June 14, 2018, 11:23 p.m.
2018-06-13 14:24 GMT+02:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:

> Attached patch fixes decoding of two files (width 999) that Piotr
> kindly provided, uploaded to
> http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket5639/

Patch applied.

Carl Eugen

Patch hide | download patch | download mbox

From 1b78ea4615522fa0dc4f8e4df422cfd26916c134 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Wed, 13 Jun 2018 14:19:45 +0200
Subject: [PATCH] lavc/dpx: Reset n_datum for every new line when decoding
 12bit.

Fixes odd unpacked 12bit decoding.
---
 libavcodec/dpx.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index fb388b6..e9f0e05 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -234,10 +234,10 @@  static int decode_frame(AVCodecContext *avctx,
     case 12:
         if (!packing) {
             int tested = 0;
-            if (descriptor == 50 && endian && (avctx->width%8) == 0) { // Little endian and widths not a multiple of 8 need tests
+            if (descriptor == 50 && endian) { // Little endian needs tests
                 tested = 1;
             }
-            if (descriptor == 51 && endian && (avctx->width%2) == 0) { // Little endian and widths not a multiple of 2 need tests
+            if (descriptor == 51 && endian) { // Little endian needs tests
                 tested = 1;
             }
             if (!tested) {
@@ -422,6 +422,7 @@  static int decode_frame(AVCodecContext *avctx,
                                                &n_datum, endian);
                 }
             }
+            n_datum = 0;
             for (i = 0; i < elements; i++)
                 ptr[i] += p->linesize[i];
             // Jump to next aligned position
-- 
1.7.10.4