if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf)) {
if (ff_ivi_init_planes(ctx->planes, &pic_conf)) {
av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate color planes!\n");
+ ctx->pic_conf.luma_bands = 0;
return AVERROR(ENOMEM);
}
band->is_empty = get_bits1(&ctx->gb);
if (!band->is_empty) {
+ int old_blk_size = band->blk_size;
/* skip header size
* If header size is not given, header size is 4 bytes. */
if (get_bits1(&ctx->gb))
band->inv_transform = transforms[transform_id].inv_trans;
band->dc_transform = transforms[transform_id].dc_trans;
band->is_2d_trans = transforms[transform_id].is_2d_trans;
+ if (transform_id < 10)
+ band->transform_size = 8;
+ else
+ band->transform_size = 4;
+
+ if (band->blk_size != band->transform_size)
+ return AVERROR_INVALIDDATA;
scan_indx = get_bits(&ctx->gb, 4);
if (scan_indx == 15) {
av_log(avctx, AV_LOG_ERROR, "Custom scan pattern encountered!\n");
return AVERROR_INVALIDDATA;
}
+ if (scan_indx > 4 && scan_indx < 10) {
+ if (band->blk_size != 4)
+ return AVERROR_INVALIDDATA;
+ } else if (band->blk_size != 8)
+ return AVERROR_INVALIDDATA;
+
band->scan = scan_index_to_tab[scan_indx];
band->quant_mat = get_bits(&ctx->gb, 5);
- if (band->quant_mat == 31) {
- av_log(avctx, AV_LOG_ERROR, "Custom quant matrix encountered!\n");
+ if (band->quant_mat >= FF_ARRAY_ELEMS(quant_index_to_tab)) {
+
+ if (band->quant_mat == 31)
+ av_log(avctx, AV_LOG_ERROR,
+ "Custom quant matrix encountered!\n");
+ else
+ avpriv_request_sample(avctx, "Quantization matrix %d",
+ band->quant_mat);
+ band->quant_mat = -1;
+ return AVERROR_INVALIDDATA;
+ }
+ } else {
+ if (old_blk_size != band->blk_size) {
+ av_log(avctx, AV_LOG_ERROR,
+ "The band block size does not match the configuration "
+ "inherited\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (band->quant_mat < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid quant_mat inherited\n");
return AVERROR_INVALIDDATA;
}
}
AVCodec ff_indeo4_decoder = {
.name = "indeo4",
+ .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 4"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_INDEO4,
.priv_data_size = sizeof(IVI45DecContext),
.init = decode_init,
.close = ff_ivi_decode_close,
.decode = ff_ivi_decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 4"),
.capabilities = CODEC_CAP_DR1,
};