Commit 9f3bfe30 authored by Christophe Gisquet's avatar Christophe Gisquet Committed by Michael Niedermayer

mpegvideo: dnxhdenc: permute 10bits content

Dequant or encoding were trying to reverse a scan that hadn't been
applied...
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 97437bd1
......@@ -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 /
......
......@@ -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,
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment