summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/dnxhdenc.c7
-rw-r--r--libavcodec/mpegvideo.h3
-rw-r--r--libavcodec/mpegvideo_enc.c6
3 files changed, 11 insertions, 5 deletions
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 7d96cd4f78..1e14b8cb1f 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 a2cd8e8c94..df1a13fff6 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 a6af8bda24..1e8d2409af 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;