mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-03 14:32:16 +02:00
avcodec/mjpegdec: Only keep what is used from ScanTable
Namely ScanTable.permutated. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
5975bb7f81
commit
3cdfb146b2
@ -115,8 +115,8 @@ static void init_idct(AVCodecContext *avctx)
|
|||||||
MJpegDecodeContext *s = avctx->priv_data;
|
MJpegDecodeContext *s = avctx->priv_data;
|
||||||
|
|
||||||
ff_idctdsp_init(&s->idsp, avctx);
|
ff_idctdsp_init(&s->idsp, avctx);
|
||||||
ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
|
ff_permute_scantable(s->permutated_scantable, ff_zigzag_direct,
|
||||||
ff_zigzag_direct);
|
s->idsp.idct_permutation);
|
||||||
}
|
}
|
||||||
|
|
||||||
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
|
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
|
||||||
@ -846,7 +846,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
|
|||||||
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
|
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
j = s->scantable.permutated[i];
|
j = s->permutated_scantable[i];
|
||||||
block[j] = level * quant_matrix[i];
|
block[j] = level * quant_matrix[i];
|
||||||
}
|
}
|
||||||
} while (i < 63);
|
} while (i < 63);
|
||||||
@ -909,14 +909,14 @@ static int decode_block_progressive(MJpegDecodeContext *s, int16_t *block,
|
|||||||
|
|
||||||
if (i >= se) {
|
if (i >= se) {
|
||||||
if (i == se) {
|
if (i == se) {
|
||||||
j = s->scantable.permutated[se];
|
j = s->permutated_scantable[se];
|
||||||
block[j] = level * (quant_matrix[se] << Al);
|
block[j] = level * (quant_matrix[se] << Al);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
|
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
j = s->scantable.permutated[i];
|
j = s->permutated_scantable[i];
|
||||||
block[j] = level * (quant_matrix[i] << Al);
|
block[j] = level * (quant_matrix[i] << Al);
|
||||||
} else {
|
} else {
|
||||||
if (run == 0xF) {// ZRL - skip 15 coefficients
|
if (run == 0xF) {// ZRL - skip 15 coefficients
|
||||||
@ -964,7 +964,7 @@ for (; ; i++) { \
|
|||||||
} \
|
} \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
j = s->scantable.permutated[i]; \
|
j = s->permutated_scantable[i]; \
|
||||||
if (block[j]) \
|
if (block[j]) \
|
||||||
REFINE_BIT(j) \
|
REFINE_BIT(j) \
|
||||||
else if (run-- == 0) \
|
else if (run-- == 0) \
|
||||||
@ -994,7 +994,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, int16_t *block,
|
|||||||
val = SHOW_UBITS(re, &s->gb, 1);
|
val = SHOW_UBITS(re, &s->gb, 1);
|
||||||
LAST_SKIP_BITS(re, &s->gb, 1);
|
LAST_SKIP_BITS(re, &s->gb, 1);
|
||||||
ZERO_RUN;
|
ZERO_RUN;
|
||||||
j = s->scantable.permutated[i];
|
j = s->permutated_scantable[i];
|
||||||
val--;
|
val--;
|
||||||
block[j] = ((quant_matrix[i] << Al) ^ val) - val;
|
block[j] = ((quant_matrix[i] << Al) ^ val) - val;
|
||||||
if (i == se) {
|
if (i == se) {
|
||||||
@ -1026,7 +1026,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, int16_t *block,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (; i <= last; i++) {
|
for (; i <= last; i++) {
|
||||||
j = s->scantable.permutated[i];
|
j = s->permutated_scantable[i];
|
||||||
if (block[j])
|
if (block[j])
|
||||||
REFINE_BIT(j)
|
REFINE_BIT(j)
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ typedef struct MJpegDecodeContext {
|
|||||||
uint64_t coefs_finished[MAX_COMPONENTS]; ///< bitmask of which coefs have been completely decoded (progressive mode)
|
uint64_t coefs_finished[MAX_COMPONENTS]; ///< bitmask of which coefs have been completely decoded (progressive mode)
|
||||||
int palette_index;
|
int palette_index;
|
||||||
int force_pal8;
|
int force_pal8;
|
||||||
ScanTable scantable;
|
uint8_t permutated_scantable[64];
|
||||||
BlockDSPContext bdsp;
|
BlockDSPContext bdsp;
|
||||||
HpelDSPContext hdsp;
|
HpelDSPContext hdsp;
|
||||||
IDCTDSPContext idsp;
|
IDCTDSPContext idsp;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user