Merge remote-tracking branch 'qatar/release/0.7' into release/0.8
* qatar/release/0.7: Update changelog for 0.7.7 release mpeg12: do not decode extradata more than once. indeo4/5: check empty tile size in decode_mb_info(). dfa: improve boundary checks in decode_dds1() indeo5dec: Make sure we have had a valid gop header. rv34: error out on size changes with frame threading Conflicts: Changelog Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -159,8 +159,7 @@ static int decode_dds1(uint8_t *frame, int width, int height,
|
|||||||
bitbuf = bytestream_get_le16(&src);
|
bitbuf = bytestream_get_le16(&src);
|
||||||
mask = 1;
|
mask = 1;
|
||||||
}
|
}
|
||||||
if (src_end - src < 2 || frame_end - frame < 2)
|
|
||||||
return -1;
|
|
||||||
if (bitbuf & mask) {
|
if (bitbuf & mask) {
|
||||||
v = bytestream_get_le16(&src);
|
v = bytestream_get_le16(&src);
|
||||||
offset = (v & 0x1FFF) << 2;
|
offset = (v & 0x1FFF) << 2;
|
||||||
@@ -174,9 +173,12 @@ static int decode_dds1(uint8_t *frame, int width, int height,
|
|||||||
frame += 2;
|
frame += 2;
|
||||||
}
|
}
|
||||||
} else if (bitbuf & (mask << 1)) {
|
} else if (bitbuf & (mask << 1)) {
|
||||||
frame += bytestream_get_le16(&src) * 2;
|
v = bytestream_get_le16(&src)*2;
|
||||||
|
if (frame - frame_end < v)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
frame += v;
|
||||||
} else {
|
} else {
|
||||||
if (frame_end - frame < width + 2)
|
if (frame_end - frame < width + 3)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
frame[0] = frame[1] =
|
frame[0] = frame[1] =
|
||||||
frame[width] = frame[width + 1] = *src++;
|
frame[width] = frame[width + 1] = *src++;
|
||||||
|
@@ -76,6 +76,8 @@ typedef struct {
|
|||||||
int is_scalable;
|
int is_scalable;
|
||||||
uint32_t lock_word;
|
uint32_t lock_word;
|
||||||
IVIPicConfig pic_conf;
|
IVIPicConfig pic_conf;
|
||||||
|
|
||||||
|
int gop_invalid;
|
||||||
} IVI5DecContext;
|
} IVI5DecContext;
|
||||||
|
|
||||||
|
|
||||||
@@ -339,8 +341,12 @@ static int decode_pic_hdr(IVI5DecContext *ctx, AVCodecContext *avctx)
|
|||||||
ctx->frame_num = get_bits(&ctx->gb, 8);
|
ctx->frame_num = get_bits(&ctx->gb, 8);
|
||||||
|
|
||||||
if (ctx->frame_type == FRAMETYPE_INTRA) {
|
if (ctx->frame_type == FRAMETYPE_INTRA) {
|
||||||
if (decode_gop_header(ctx, avctx))
|
ctx->gop_invalid = 1;
|
||||||
return -1;
|
if (decode_gop_header(ctx, avctx)) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Invalid GOP header, skipping frames.\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
ctx->gop_invalid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->frame_type != FRAMETYPE_NULL) {
|
if (ctx->frame_type != FRAMETYPE_NULL) {
|
||||||
@@ -617,8 +623,10 @@ static int decode_band(IVI5DecContext *ctx, int plane_num,
|
|||||||
|
|
||||||
tile->is_empty = get_bits1(&ctx->gb);
|
tile->is_empty = get_bits1(&ctx->gb);
|
||||||
if (tile->is_empty) {
|
if (tile->is_empty) {
|
||||||
ff_ivi_process_empty_tile(avctx, band, tile,
|
result = ff_ivi_process_empty_tile(avctx, band, tile,
|
||||||
(ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3));
|
(ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3));
|
||||||
|
if (result < 0)
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
tile->data_size = ff_ivi_dec_tile_data_size(&ctx->gb);
|
tile->data_size = ff_ivi_dec_tile_data_size(&ctx->gb);
|
||||||
|
|
||||||
@@ -765,6 +773,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
|||||||
"Error while decoding picture header: %d\n", result);
|
"Error while decoding picture header: %d\n", result);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (ctx->gop_invalid)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (ctx->gop_flags & IVI5_IS_PROTECTED) {
|
if (ctx->gop_flags & IVI5_IS_PROTECTED) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Password-protected clip!\n");
|
av_log(avctx, AV_LOG_ERROR, "Password-protected clip!\n");
|
||||||
|
@@ -495,7 +495,7 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
|
int ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
|
||||||
IVITile *tile, int32_t mv_scale)
|
IVITile *tile, int32_t mv_scale)
|
||||||
{
|
{
|
||||||
int x, y, need_mc, mbn, blk, num_blocks, mv_x, mv_y, mc_type;
|
int x, y, need_mc, mbn, blk, num_blocks, mv_x, mv_y, mc_type;
|
||||||
@@ -506,6 +506,13 @@ void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
|
|||||||
void (*mc_no_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch,
|
void (*mc_no_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch,
|
||||||
int mc_type);
|
int mc_type);
|
||||||
|
|
||||||
|
if (tile->num_MBs != IVI_MBs_PER_TILE(tile->width, tile->height, band->mb_size)) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Allocated tile size %d mismatches "
|
||||||
|
"parameters %d in ivi_process_empty_tile()\n",
|
||||||
|
tile->num_MBs, IVI_MBs_PER_TILE(tile->width, tile->height, band->mb_size));
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
offs = tile->ypos * band->pitch + tile->xpos;
|
offs = tile->ypos * band->pitch + tile->xpos;
|
||||||
mb = tile->mbs;
|
mb = tile->mbs;
|
||||||
ref_mb = tile->ref_mbs;
|
ref_mb = tile->ref_mbs;
|
||||||
@@ -586,6 +593,8 @@ void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
|
|||||||
dst += band->pitch;
|
dst += band->pitch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -325,7 +325,7 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile);
|
|||||||
* @param[in] tile pointer to the tile descriptor
|
* @param[in] tile pointer to the tile descriptor
|
||||||
* @param[in] mv_scale scaling factor for motion vectors
|
* @param[in] mv_scale scaling factor for motion vectors
|
||||||
*/
|
*/
|
||||||
void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
|
int ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
|
||||||
IVITile *tile, int32_t mv_scale);
|
IVITile *tile, int32_t mv_scale);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1151,6 +1151,7 @@ typedef struct Mpeg1Context {
|
|||||||
int save_width, save_height, save_progressive_seq;
|
int save_width, save_height, save_progressive_seq;
|
||||||
AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator
|
AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator
|
||||||
int sync; ///< Did we reach a sync point like a GOP/SEQ/KEYFrame?
|
int sync; ///< Did we reach a sync point like a GOP/SEQ/KEYFrame?
|
||||||
|
int extradata_decoded;
|
||||||
} Mpeg1Context;
|
} Mpeg1Context;
|
||||||
|
|
||||||
static av_cold int mpeg_decode_init(AVCodecContext *avctx)
|
static av_cold int mpeg_decode_init(AVCodecContext *avctx)
|
||||||
@@ -2315,8 +2316,10 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
s->slice_count= 0;
|
s->slice_count= 0;
|
||||||
|
|
||||||
if(avctx->extradata && !avctx->frame_number)
|
if (avctx->extradata && !s->extradata_decoded) {
|
||||||
decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size);
|
decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size);
|
||||||
|
s->extradata_decoded = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return decode_chunks(avctx, picture, data_size, buf, buf_size);
|
return decode_chunks(avctx, picture, data_size, buf, buf_size);
|
||||||
}
|
}
|
||||||
|
@@ -1280,6 +1280,14 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
|
|||||||
|
|
||||||
if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr==NULL) {
|
if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr==NULL) {
|
||||||
if(s->width != r->si.width || s->height != r->si.height){
|
if(s->width != r->si.width || s->height != r->si.height){
|
||||||
|
|
||||||
|
if (HAVE_THREADS &&
|
||||||
|
(s->avctx->active_thread_type & FF_THREAD_FRAME)) {
|
||||||
|
av_log_missing_feature(s->avctx, "Width/height changing with "
|
||||||
|
"frame threading is", 0);
|
||||||
|
return AVERROR_PATCHWELCOME;
|
||||||
|
}
|
||||||
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "Changing dimensions to %dx%d\n", r->si.width,r->si.height);
|
av_log(s->avctx, AV_LOG_DEBUG, "Changing dimensions to %dx%d\n", r->si.width,r->si.height);
|
||||||
MPV_common_end(s);
|
MPV_common_end(s);
|
||||||
s->width = r->si.width;
|
s->width = r->si.width;
|
||||||
|
Reference in New Issue
Block a user