[FFmpeg-cvslog] mpegvideo: dnxhdenc: permute 10bits content
Christophe Gisquet
git at videolan.org
Tue Oct 13 00:19:53 CEST 2015
ffmpeg | branch: master | Christophe Gisquet <christophe.gisquet at gmail.com> | Mon Oct 12 19:37:42 2015 +0200| [9f3bfe30dd99b093a469e566dbd95448b32f80e9] | committer: Michael Niedermayer
mpegvideo: dnxhdenc: permute 10bits content
Dequant or encoding were trying to reverse a scan that hadn't been
applied...
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f3bfe30dd99b093a469e566dbd95448b32f80e9
---
libavcodec/dnxhdenc.c | 7 ++++++-
libavcodec/mpegvideo.h | 3 ++-
libavcodec/mpegvideo_enc.c | 6 +++---
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 7d96cd4..1e14b8c 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -128,6 +128,11 @@ static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx, int16_t *block,
last_non_zero = i;
}
+ /* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */
+ if (ctx->idsp.perm_type != FF_IDCT_PERM_NONE)
+ ff_block_permute(block, ctx->idsp.idct_permutation,
+ scantable, last_non_zero);
+
return last_non_zero;
}
@@ -241,7 +246,7 @@ static av_cold int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias)
// 10-bit
for (qscale = 1; qscale <= ctx->m.avctx->qmax; qscale++) {
for (i = 1; i < 64; i++) {
- int j = ctx->m.idsp.idct_permutation[ff_zigzag_direct[i]];
+ int j = ff_zigzag_direct[i];
/* The quantization formula from the VC-3 standard is:
* quantized = sign(block[i]) * floor(abs(block[i]/s) * p /
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index a2cd8e8..df1a13f 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -660,7 +660,8 @@ int ff_dct_encode_init(MpegEncContext *s);
void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[2][64],
const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra);
int ff_dct_quantize_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
-
+void ff_block_permute(int16_t *block, uint8_t *permutation,
+ const uint8_t *scantable, int last);
void ff_init_block_index(MpegEncContext *s);
void ff_mpv_motion(MpegEncContext *s,
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index a6af8bd..1e8d240 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -4555,8 +4555,8 @@ STOP_TIMER("iterative search")
* permutation up, the block is not (inverse) permutated
* to scantable order!
*/
-static void block_permute(int16_t *block, uint8_t *permutation,
- const uint8_t *scantable, int last)
+void ff_block_permute(int16_t *block, uint8_t *permutation,
+ const uint8_t *scantable, int last)
{
int i;
int16_t temp[64];
@@ -4655,7 +4655,7 @@ int ff_dct_quantize_c(MpegEncContext *s,
/* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */
if (s->idsp.perm_type != FF_IDCT_PERM_NONE)
- block_permute(block, s->idsp.idct_permutation,
+ ff_block_permute(block, s->idsp.idct_permutation,
scantable, last_non_zero);
return last_non_zero;
More information about the ffmpeg-cvslog
mailing list