[FFmpeg-devel] [RFC]lavc/ffv1dec: Scale msb-packed output to full 16bit

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Nov 16 13:15:28 EET 2016


Hi!

Attached patch improves output for some ffv1 files imo.
Current slowdown for the existing decode-line timer is 
2%, I wonder if this can be improved through refactoring.

Please comment, Carl Eugen
-------------- next part --------------
From e4e8277d4f0daeb9f61c2da9ebb167a084b1b93c Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Wed, 16 Nov 2016 12:03:17 +0100
Subject: [PATCH] lavc/ffv1dec: Scale output for msb-packed compression to
 full 16bit.

2% slowdown for existing decode-line timer.
---
 libavcodec/ffv1dec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d8f35c3..0719e28 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -142,7 +142,7 @@ static void decode_plane(FFV1Context *s, uint8_t *src,
                 }
             } else {
                 for (x = 0; x < w; x++) {
-                    ((uint16_t*)(src + stride*y))[x*pixel_stride] = sample[1][x] << (16 - s->avctx->bits_per_raw_sample);
+                    ((uint16_t*)(src + stride*y))[x*pixel_stride] = sample[1][x] << (16 - s->avctx->bits_per_raw_sample) | ((uint16_t **)sample)[1][x] >> (2 * s->avctx->bits_per_raw_sample - 16);
                 }
             }
         }
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list