mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-09 14:14:39 +02:00
avcodec/proresdec2: Don't apply non-zero offset to null pointer
Affected ProRes without alpha; affected 32 FATE tests, e.g. prores-422, prores-422_proxy, prores-422_lt or matroska-prores-header-insertion-bz2. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (cherry picked from commit f83976344ecdc776ec827b06b19c2fcaa2b8ccdb)
This commit is contained in:
parent
09510d9ffd
commit
789dadccc0
@ -623,8 +623,8 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
|
|||||||
AVFrame *pic = ctx->frame;
|
AVFrame *pic = ctx->frame;
|
||||||
int i, hdr_size, qscale, log2_chroma_blocks_per_mb;
|
int i, hdr_size, qscale, log2_chroma_blocks_per_mb;
|
||||||
int luma_stride, chroma_stride;
|
int luma_stride, chroma_stride;
|
||||||
int y_data_size, u_data_size, v_data_size, a_data_size;
|
int y_data_size, u_data_size, v_data_size, a_data_size, offset;
|
||||||
uint8_t *dest_y, *dest_u, *dest_v, *dest_a;
|
uint8_t *dest_y, *dest_u, *dest_v;
|
||||||
LOCAL_ALIGNED_16(int16_t, qmat_luma_scaled, [64]);
|
LOCAL_ALIGNED_16(int16_t, qmat_luma_scaled, [64]);
|
||||||
LOCAL_ALIGNED_16(int16_t, qmat_chroma_scaled,[64]);
|
LOCAL_ALIGNED_16(int16_t, qmat_chroma_scaled,[64]);
|
||||||
int mb_x_shift;
|
int mb_x_shift;
|
||||||
@ -676,16 +676,16 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
|
|||||||
log2_chroma_blocks_per_mb = 1;
|
log2_chroma_blocks_per_mb = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dest_y = pic->data[0] + (slice->mb_y << 4) * luma_stride + (slice->mb_x << 5);
|
offset = (slice->mb_y << 4) * luma_stride + (slice->mb_x << 5);
|
||||||
|
dest_y = pic->data[0] + offset;
|
||||||
dest_u = pic->data[1] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift);
|
dest_u = pic->data[1] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift);
|
||||||
dest_v = pic->data[2] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift);
|
dest_v = pic->data[2] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift);
|
||||||
dest_a = pic->data[3] + (slice->mb_y << 4) * luma_stride + (slice->mb_x << 5);
|
|
||||||
|
|
||||||
if (ctx->frame_type && ctx->first_field ^ ctx->frame->top_field_first) {
|
if (ctx->frame_type && ctx->first_field ^ ctx->frame->top_field_first) {
|
||||||
dest_y += pic->linesize[0];
|
dest_y += pic->linesize[0];
|
||||||
dest_u += pic->linesize[1];
|
dest_u += pic->linesize[1];
|
||||||
dest_v += pic->linesize[2];
|
dest_v += pic->linesize[2];
|
||||||
dest_a += pic->linesize[3];
|
offset += pic->linesize[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = decode_slice_luma(avctx, slice, (uint16_t*)dest_y, luma_stride,
|
ret = decode_slice_luma(avctx, slice, (uint16_t*)dest_y, luma_stride,
|
||||||
@ -722,10 +722,12 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* decode alpha plane if available */
|
/* decode alpha plane if available */
|
||||||
if (ctx->alpha_info && pic->data[3] && a_data_size)
|
if (ctx->alpha_info && pic->data[3] && a_data_size) {
|
||||||
|
uint8_t *dest_a = pic->data[3] + offset;
|
||||||
decode_slice_alpha(ctx, (uint16_t*)dest_a, luma_stride,
|
decode_slice_alpha(ctx, (uint16_t*)dest_a, luma_stride,
|
||||||
buf + y_data_size + u_data_size + v_data_size,
|
buf + y_data_size + u_data_size + v_data_size,
|
||||||
a_data_size, slice->mb_count);
|
a_data_size, slice->mb_count);
|
||||||
|
}
|
||||||
|
|
||||||
slice->ret = 0;
|
slice->ret = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user