mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 03:09:51 +00:00
ffmpeg
Signed-off-by: Atrotro <wanganzhouhh@163.com>
This commit is contained in:
parent
ed24d866ce
commit
57091e53f9
@ -628,6 +628,10 @@ static int hls_slice_header(HEVCContext *s)
|
||||
|
||||
if (s->ps.pps->dependent_slice_segments_enabled_flag)
|
||||
sh->dependent_slice_segment_flag = get_bits1(gb);
|
||||
if (sh->dependent_slice_segment_flag && !s->slice_initialized) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Independent slice segment missing.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
slice_address_length = av_ceil_log2(s->ps.sps->ctb_width *
|
||||
s->ps.sps->ctb_height);
|
||||
@ -896,9 +900,6 @@ static int hls_slice_header(HEVCContext *s)
|
||||
} else {
|
||||
sh->slice_loop_filter_across_slices_enabled_flag = s->ps.pps->seq_loop_filter_across_slices_enabled_flag;
|
||||
}
|
||||
} else if (!s->slice_initialized) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Independent slice segment missing.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
sh->num_entry_point_offsets = 0;
|
||||
@ -3179,8 +3180,11 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
|
||||
case HEVC_NAL_RASL_N:
|
||||
case HEVC_NAL_RASL_R:
|
||||
ret = hls_slice_header(s);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
// hls_slice_header() does not cleanup on failure thus the state now is inconsistant so we cannot use it on dependant slices
|
||||
s->slice_initialized = 0;
|
||||
return ret;
|
||||
}
|
||||
if (ret == 1) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
|
@ -2979,7 +2979,7 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
int ret;
|
||||
|
||||
// Check for minimal intra MB size (considering mb header, luma & chroma dc VLC, ac EOB VLC)
|
||||
if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2 + 3*4 + 2*2 + 2*6))
|
||||
if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2LL + 3*4 + 2*2 + 2*6))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = ff_get_buffer(avctx, frame, 0);
|
||||
|
@ -2754,12 +2754,14 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
|
||||
av_buffer_pool_uninit(&ctx->output_buffer_pool);
|
||||
|
||||
if (ctx->va_context != VA_INVALID_ID) {
|
||||
vaDestroyContext(ctx->hwctx->display, ctx->va_context);
|
||||
if (ctx->hwctx)
|
||||
vaDestroyContext(ctx->hwctx->display, ctx->va_context);
|
||||
ctx->va_context = VA_INVALID_ID;
|
||||
}
|
||||
|
||||
if (ctx->va_config != VA_INVALID_ID) {
|
||||
vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
|
||||
if (ctx->hwctx)
|
||||
vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
|
||||
ctx->va_config = VA_INVALID_ID;
|
||||
}
|
||||
|
||||
|
@ -122,13 +122,16 @@ static int read_header(AVFormatContext *avctx)
|
||||
s->chars_per_frame = FFMAX(av_q2d(st->time_base)*s->chars_per_frame, 1);
|
||||
|
||||
if (avctx->pb->seekable & AVIO_SEEKABLE_NORMAL) {
|
||||
s->fsize = avio_size(avctx->pb);
|
||||
st->duration = (s->fsize + s->chars_per_frame - 1) / s->chars_per_frame;
|
||||
int64_t fsize = avio_size(avctx->pb);
|
||||
if (fsize > 0) {
|
||||
s->fsize = avio_size(avctx->pb);
|
||||
st->duration = (s->fsize + s->chars_per_frame - 1) / s->chars_per_frame;
|
||||
|
||||
if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0)
|
||||
efi_read(avctx, s->fsize - 51);
|
||||
|
||||
if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0)
|
||||
efi_read(avctx, s->fsize - 51);
|
||||
|
||||
avio_seek(avctx->pb, 0, SEEK_SET);
|
||||
avio_seek(avctx->pb, 0, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
fail:
|
||||
|
@ -219,6 +219,8 @@ static int xmv_read_header(AVFormatContext *s)
|
||||
/* Initialize the packet context */
|
||||
|
||||
xmv->next_packet_offset = avio_tell(pb);
|
||||
if (this_packet_size < xmv->next_packet_offset)
|
||||
return AVERROR_INVALIDDATA;
|
||||
xmv->next_packet_size = this_packet_size - xmv->next_packet_offset;
|
||||
xmv->stream_count = xmv->audio_track_count + 1;
|
||||
|
||||
|
@ -909,7 +909,7 @@ int av_frame_apply_cropping(AVFrame *frame, int flags)
|
||||
if (log2_crop_align < min_log2_align)
|
||||
return AVERROR_BUG;
|
||||
|
||||
if (min_log2_align < 5) {
|
||||
if (min_log2_align < 5 && log2_crop_align != INT_MAX) {
|
||||
frame->crop_left &= ~((1 << (5 + log2_crop_align - min_log2_align)) - 1);
|
||||
calc_cropping_offsets(offsets, frame, desc);
|
||||
}
|
||||
|
@ -1180,8 +1180,8 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
|
||||
if (uvalpha < 2048) {
|
||||
for (i = 0; i < ((dstW + 1) >> 1); i++) {
|
||||
int Y1 = (buf0[i * 2] ) >> 2;
|
||||
int Y2 = (buf0[i * 2 + 1]) >> 2;
|
||||
SUINT Y1 = (buf0[i * 2] ) >> 2;
|
||||
SUINT Y2 = (buf0[i * 2 + 1]) >> 2;
|
||||
int U = (ubuf0[i] - (128 << 11)) >> 2;
|
||||
int V = (vbuf0[i] - (128 << 11)) >> 2;
|
||||
int R, G, B;
|
||||
@ -1205,20 +1205,20 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
|
||||
dest += 8;
|
||||
} else {
|
||||
output_pixel(&dest[3], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
|
||||
dest += 6;
|
||||
}
|
||||
}
|
||||
@ -1226,8 +1226,8 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
|
||||
int A1 = 0xffff<<14, A2 = 0xffff<<14;
|
||||
for (i = 0; i < ((dstW + 1) >> 1); i++) {
|
||||
int Y1 = (buf0[i * 2] ) >> 2;
|
||||
int Y2 = (buf0[i * 2 + 1]) >> 2;
|
||||
SUINT Y1 = (buf0[i * 2] ) >> 2;
|
||||
SUINT Y2 = (buf0[i * 2 + 1]) >> 2;
|
||||
int U = (ubuf0[i] + ubuf1[i] - (128 << 12)) >> 3;
|
||||
int V = (vbuf0[i] + vbuf1[i] - (128 << 12)) >> 3;
|
||||
int R, G, B;
|
||||
@ -1251,20 +1251,20 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
|
||||
dest += 8;
|
||||
} else {
|
||||
output_pixel(&dest[3], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
|
||||
dest += 6;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user