mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-05 14:30:00 +01:00
Compare commits
4 Commits
a6206a31ea
...
04eeaeed11
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04eeaeed11 | ||
|
|
f83fdad550 | ||
|
|
6e0034ab7e | ||
|
|
372dab2a4d |
@@ -437,10 +437,11 @@ av_cold void ff_codec_close(AVCodecContext *avctx)
|
||||
if (avcodec_is_open(avctx)) {
|
||||
AVCodecInternal *avci = avctx->internal;
|
||||
|
||||
if (CONFIG_FRAME_THREAD_ENCODER &&
|
||||
avci->frame_thread_encoder && avctx->thread_count > 1) {
|
||||
#if CONFIG_FRAME_THREAD_ENCODER
|
||||
if (avci->frame_thread_encoder && avctx->thread_count > 1) {
|
||||
ff_frame_thread_encoder_free(avctx);
|
||||
}
|
||||
#endif
|
||||
if (HAVE_THREADS && avci->thread_ctx)
|
||||
ff_thread_free(avctx);
|
||||
if (avci->needs_close && ffcodec(avctx->codec)->close)
|
||||
|
||||
@@ -317,12 +317,13 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
|
||||
|
||||
av_assert0(codec->cb_type == FF_CODEC_CB_TYPE_ENCODE);
|
||||
|
||||
if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder)
|
||||
#if CONFIG_FRAME_THREAD_ENCODER
|
||||
if (avci->frame_thread_encoder)
|
||||
/* This will unref frame. */
|
||||
ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet);
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet);
|
||||
}
|
||||
|
||||
if (avci->draining && !got_packet)
|
||||
avci->draining_done = 1;
|
||||
@@ -825,11 +826,11 @@ int ff_encode_preinit(AVCodecContext *avctx)
|
||||
memcpy(sd_packet->data, sd_frame->data, sd_frame->size);
|
||||
}
|
||||
|
||||
if (CONFIG_FRAME_THREAD_ENCODER) {
|
||||
ret = ff_frame_thread_encoder_init(avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
#if CONFIG_FRAME_THREAD_ENCODER
|
||||
ret = ff_frame_thread_encoder_init(avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -85,8 +85,10 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep4_16_ssse3;
|
||||
else if (channels == 6)
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep6_16_ssse3;
|
||||
else if (ARCH_X86_64 && channels == 8)
|
||||
#if ARCH_X86_64
|
||||
else if (channels == 8)
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep8_16_ssse3;
|
||||
#endif
|
||||
} else if (fmt == AV_SAMPLE_FMT_S32) {
|
||||
if (channels == 2)
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep2_32_ssse3;
|
||||
@@ -94,8 +96,10 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep4_32_ssse3;
|
||||
else if (channels == 6)
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep6_32_ssse3;
|
||||
else if (ARCH_X86_64 && channels == 8)
|
||||
#if ARCH_X86_64
|
||||
else if (channels == 8)
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep8_32_ssse3;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (EXTERNAL_SSE4(cpu_flags)) {
|
||||
@@ -105,15 +109,19 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int
|
||||
}
|
||||
if (EXTERNAL_AVX(cpu_flags)) {
|
||||
if (fmt == AV_SAMPLE_FMT_S16) {
|
||||
if (ARCH_X86_64 && channels == 8)
|
||||
#if ARCH_X86_64
|
||||
if (channels == 8)
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep8_16_avx;
|
||||
#endif
|
||||
} else if (fmt == AV_SAMPLE_FMT_S32) {
|
||||
if (channels == 4)
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep4_32_avx;
|
||||
else if (channels == 6)
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep6_32_avx;
|
||||
else if (ARCH_X86_64 && channels == 8)
|
||||
#if ARCH_X86_64
|
||||
else if (channels == 8)
|
||||
c->decorrelate[0] = ff_flac_decorrelate_indep8_32_avx;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (EXTERNAL_XOP(cpu_flags)) {
|
||||
|
||||
@@ -821,13 +821,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
if (EXTERNAL_SSE2(cpu_flags)) {
|
||||
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_sse2;
|
||||
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_sse2;
|
||||
if (ARCH_X86_64) {
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_sse2;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_sse2;
|
||||
#if ARCH_X86_64
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_sse2;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_sse2;
|
||||
|
||||
c->idct[2] = ff_hevc_idct_16x16_8_sse2;
|
||||
c->idct[3] = ff_hevc_idct_32x32_8_sse2;
|
||||
}
|
||||
c->idct[2] = ff_hevc_idct_16x16_8_sse2;
|
||||
c->idct[3] = ff_hevc_idct_32x32_8_sse2;
|
||||
#endif
|
||||
SAO_BAND_INIT(8, sse2);
|
||||
|
||||
c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_sse2;
|
||||
@@ -843,10 +843,10 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
c->add_residual[3] = ff_hevc_add_residual_32_8_sse2;
|
||||
}
|
||||
if (EXTERNAL_SSSE3(cpu_flags)) {
|
||||
if(ARCH_X86_64) {
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_ssse3;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_ssse3;
|
||||
}
|
||||
#if ARCH_X86_64
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_ssse3;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_ssse3;
|
||||
#endif
|
||||
SAO_EDGE_INIT(8, ssse3);
|
||||
}
|
||||
#if HAVE_SSE4_EXTERNAL && ARCH_X86_64
|
||||
@@ -866,13 +866,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
if (EXTERNAL_AVX(cpu_flags)) {
|
||||
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_avx;
|
||||
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_avx;
|
||||
if (ARCH_X86_64) {
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_avx;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_avx;
|
||||
#if ARCH_X86_64
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_avx;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_avx;
|
||||
|
||||
c->idct[2] = ff_hevc_idct_16x16_8_avx;
|
||||
c->idct[3] = ff_hevc_idct_32x32_8_avx;
|
||||
}
|
||||
c->idct[2] = ff_hevc_idct_16x16_8_avx;
|
||||
c->idct[3] = ff_hevc_idct_32x32_8_avx;
|
||||
#endif
|
||||
SAO_BAND_INIT(8, avx);
|
||||
|
||||
c->idct[0] = ff_hevc_idct_4x4_8_avx;
|
||||
@@ -982,7 +982,8 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
c->add_residual[3] = ff_hevc_add_residual_32_8_avx2;
|
||||
}
|
||||
#endif /* HAVE_AVX2_EXTERNAL */
|
||||
if (EXTERNAL_AVX512ICL(cpu_flags) && ARCH_X86_64) {
|
||||
#if ARCH_X86_64
|
||||
if (EXTERNAL_AVX512ICL(cpu_flags)) {
|
||||
c->put_hevc_qpel[1][0][1] = ff_hevc_put_qpel_h4_8_avx512icl;
|
||||
c->put_hevc_qpel[3][0][1] = ff_hevc_put_qpel_h8_8_avx512icl;
|
||||
c->put_hevc_qpel[5][0][1] = ff_hevc_put_qpel_h16_8_avx512icl;
|
||||
@@ -990,6 +991,7 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
c->put_hevc_qpel[9][0][1] = ff_hevc_put_qpel_h64_8_avx512icl;
|
||||
c->put_hevc_qpel[3][1][1] = ff_hevc_put_qpel_hv8_8_avx512icl;
|
||||
}
|
||||
#endif
|
||||
} else if (bit_depth == 10) {
|
||||
if (EXTERNAL_MMXEXT(cpu_flags)) {
|
||||
c->add_residual[0] = ff_hevc_add_residual_4_10_mmxext;
|
||||
@@ -997,13 +999,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
if (EXTERNAL_SSE2(cpu_flags)) {
|
||||
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_sse2;
|
||||
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_sse2;
|
||||
if (ARCH_X86_64) {
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_sse2;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_sse2;
|
||||
#if ARCH_X86_64
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_sse2;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_sse2;
|
||||
|
||||
c->idct[2] = ff_hevc_idct_16x16_10_sse2;
|
||||
c->idct[3] = ff_hevc_idct_32x32_10_sse2;
|
||||
}
|
||||
c->idct[2] = ff_hevc_idct_16x16_10_sse2;
|
||||
c->idct[3] = ff_hevc_idct_32x32_10_sse2;
|
||||
#endif
|
||||
SAO_BAND_INIT(10, sse2);
|
||||
SAO_EDGE_INIT(10, sse2);
|
||||
|
||||
@@ -1019,10 +1021,12 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
c->add_residual[2] = ff_hevc_add_residual_16_10_sse2;
|
||||
c->add_residual[3] = ff_hevc_add_residual_32_10_sse2;
|
||||
}
|
||||
if (EXTERNAL_SSSE3(cpu_flags) && ARCH_X86_64) {
|
||||
#if ARCH_X86_64
|
||||
if (EXTERNAL_SSSE3(cpu_flags)) {
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_ssse3;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_ssse3;
|
||||
}
|
||||
#endif
|
||||
#if HAVE_SSE4_EXTERNAL && ARCH_X86_64
|
||||
if (EXTERNAL_SSE4(cpu_flags)) {
|
||||
EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 10, sse4);
|
||||
@@ -1039,13 +1043,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
if (EXTERNAL_AVX(cpu_flags)) {
|
||||
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_avx;
|
||||
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_avx;
|
||||
if (ARCH_X86_64) {
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_avx;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_avx;
|
||||
#if ARCH_X86_64
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_avx;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_avx;
|
||||
|
||||
c->idct[2] = ff_hevc_idct_16x16_10_avx;
|
||||
c->idct[3] = ff_hevc_idct_32x32_10_avx;
|
||||
}
|
||||
c->idct[2] = ff_hevc_idct_16x16_10_avx;
|
||||
c->idct[3] = ff_hevc_idct_32x32_10_avx;
|
||||
#endif
|
||||
|
||||
c->idct[0] = ff_hevc_idct_4x4_10_avx;
|
||||
c->idct[1] = ff_hevc_idct_8x8_10_avx;
|
||||
@@ -1216,10 +1220,10 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
if (EXTERNAL_SSE2(cpu_flags)) {
|
||||
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_12_sse2;
|
||||
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_12_sse2;
|
||||
if (ARCH_X86_64) {
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_sse2;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_sse2;
|
||||
}
|
||||
#if ARCH_X86_64
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_sse2;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_sse2;
|
||||
#endif
|
||||
SAO_BAND_INIT(12, sse2);
|
||||
SAO_EDGE_INIT(12, sse2);
|
||||
|
||||
@@ -1228,10 +1232,12 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
c->idct_dc[2] = ff_hevc_idct_16x16_dc_12_sse2;
|
||||
c->idct_dc[3] = ff_hevc_idct_32x32_dc_12_sse2;
|
||||
}
|
||||
if (EXTERNAL_SSSE3(cpu_flags) && ARCH_X86_64) {
|
||||
#if ARCH_X86_64
|
||||
if (EXTERNAL_SSSE3(cpu_flags)) {
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_ssse3;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_ssse3;
|
||||
}
|
||||
#endif
|
||||
#if HAVE_SSE4_EXTERNAL && ARCH_X86_64
|
||||
if (EXTERNAL_SSE4(cpu_flags)) {
|
||||
EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 12, sse4);
|
||||
@@ -1248,10 +1254,10 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
|
||||
if (EXTERNAL_AVX(cpu_flags)) {
|
||||
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_12_avx;
|
||||
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_12_avx;
|
||||
if (ARCH_X86_64) {
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_avx;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_avx;
|
||||
}
|
||||
#if ARCH_X86_64
|
||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_avx;
|
||||
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_avx;
|
||||
#endif
|
||||
SAO_BAND_INIT(12, avx);
|
||||
}
|
||||
if (EXTERNAL_AVX2(cpu_flags)) {
|
||||
|
||||
@@ -83,8 +83,8 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ARCH_X86_64 &&
|
||||
!high_bit_depth &&
|
||||
#if ARCH_X86_64
|
||||
if (!high_bit_depth &&
|
||||
avctx->lowres == 0 &&
|
||||
(avctx->idct_algo == FF_IDCT_AUTO ||
|
||||
avctx->idct_algo == FF_IDCT_SIMPLEAUTO ||
|
||||
@@ -95,9 +95,11 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
|
||||
c->idct_add = ff_simple_idct8_add_sse2;
|
||||
c->perm_type = FF_IDCT_PERM_TRANSPOSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ARCH_X86_64 && avctx->lowres == 0) {
|
||||
#if ARCH_X86_64
|
||||
if (avctx->lowres == 0) {
|
||||
if (EXTERNAL_AVX(cpu_flags) &&
|
||||
!high_bit_depth &&
|
||||
(avctx->idct_algo == FF_IDCT_AUTO ||
|
||||
@@ -147,4 +149,5 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -200,8 +200,10 @@ av_cold void ff_mlpdsp_init_x86(MLPDSPContext *c)
|
||||
if (INLINE_MMX(cpu_flags))
|
||||
c->mlp_filter_channel = mlp_filter_channel_x86;
|
||||
#endif
|
||||
if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags))
|
||||
#if ARCH_X86_64
|
||||
if (EXTERNAL_SSE4(cpu_flags))
|
||||
c->mlp_rematrix_channel = ff_mlp_rematrix_channel_sse4;
|
||||
if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags) && cpu_flags & AV_CPU_FLAG_BMI2)
|
||||
if (EXTERNAL_AVX2_FAST(cpu_flags) && cpu_flags & AV_CPU_FLAG_BMI2)
|
||||
c->mlp_rematrix_channel = ff_mlp_rematrix_channel_avx2_bmi2;
|
||||
#endif // ARCH_X86_64
|
||||
}
|
||||
|
||||
@@ -38,28 +38,38 @@ av_cold void ff_v210_x86_init(V210DecContext *s)
|
||||
if (s->aligned_input) {
|
||||
if (cpu_flags & AV_CPU_FLAG_SSSE3)
|
||||
s->unpack_frame = ff_v210_planar_unpack_aligned_ssse3;
|
||||
|
||||
if (HAVE_AVX_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX)
|
||||
#if HAVE_AVX_EXTERNAL
|
||||
if (cpu_flags & AV_CPU_FLAG_AVX)
|
||||
s->unpack_frame = ff_v210_planar_unpack_aligned_avx;
|
||||
#endif
|
||||
|
||||
if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2)
|
||||
#if HAVE_AVX2_EXTERNAL
|
||||
if (cpu_flags & AV_CPU_FLAG_AVX2)
|
||||
s->unpack_frame = ff_v210_planar_unpack_aligned_avx2;
|
||||
#endif
|
||||
|
||||
#if HAVE_AVX512ICL_EXTERNAL
|
||||
if (EXTERNAL_AVX512ICL(cpu_flags))
|
||||
s->unpack_frame = ff_v210_planar_unpack_avx512icl;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
if (cpu_flags & AV_CPU_FLAG_SSSE3)
|
||||
s->unpack_frame = ff_v210_planar_unpack_unaligned_ssse3;
|
||||
|
||||
if (HAVE_AVX_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX)
|
||||
#if HAVE_AVX_EXTERNAL
|
||||
if (cpu_flags & AV_CPU_FLAG_AVX)
|
||||
s->unpack_frame = ff_v210_planar_unpack_unaligned_avx;
|
||||
#endif
|
||||
|
||||
if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2)
|
||||
#if HAVE_AVX2_EXTERNAL
|
||||
if (cpu_flags & AV_CPU_FLAG_AVX2)
|
||||
s->unpack_frame = ff_v210_planar_unpack_unaligned_avx2;
|
||||
#endif
|
||||
|
||||
#if HAVE_AVX512ICL_EXTERNAL
|
||||
if (EXTERNAL_AVX512ICL(cpu_flags))
|
||||
s->unpack_frame = ff_v210_planar_unpack_avx512icl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // HAVE_X86ASM
|
||||
}
|
||||
|
||||
@@ -71,11 +71,12 @@ av_cold void ff_v210enc_init_x86(V210EncContext *s)
|
||||
s->pack_line_10 = ff_v210_planar_pack_10_avx512;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAVE_AVX512ICL_EXTERNAL
|
||||
if (EXTERNAL_AVX512ICL(cpu_flags)) {
|
||||
s->sample_factor_8 = 4;
|
||||
s->pack_line_8 = ff_v210_planar_pack_8_avx512icl;
|
||||
s->sample_factor_10 = 4;
|
||||
s->pack_line_10 = ff_v210_planar_pack_10_avx512icl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -861,6 +861,11 @@ static const AVFrame *ref_frame(const struct pl_frame_mix *mix)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline double q2d_fallback(AVRational q, const double def)
|
||||
{
|
||||
return (q.num && q.den) ? av_q2d(q) : def;
|
||||
}
|
||||
|
||||
static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
|
||||
struct pl_frame *target, double target_pts)
|
||||
{
|
||||
@@ -882,8 +887,7 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
|
||||
s->var_values[VAR_IN_W] = s->var_values[VAR_IW] = inlink->w;
|
||||
s->var_values[VAR_IN_H] = s->var_values[VAR_IH] = inlink->h;
|
||||
s->var_values[VAR_A] = (double) inlink->w / inlink->h;
|
||||
s->var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
|
||||
av_q2d(inlink->sample_aspect_ratio) : 1.0;
|
||||
s->var_values[VAR_SAR] = q2d_fallback(inlink->sample_aspect_ratio, 1.0);
|
||||
s->var_values[VAR_IN_T] = s->var_values[VAR_T] = image_pts;
|
||||
s->var_values[VAR_OUT_T] = s->var_values[VAR_OT] = target_pts;
|
||||
s->var_values[VAR_N] = outl->frame_count_out;
|
||||
@@ -913,14 +917,6 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
|
||||
image->crop.x1 = image->crop.x0 + s->var_values[VAR_CROP_W];
|
||||
image->crop.y1 = image->crop.y0 + s->var_values[VAR_CROP_H];
|
||||
|
||||
const pl_rotation rot_total = image->rotation - target->rotation;
|
||||
if ((rot_total + PL_ROTATION_360) % PL_ROTATION_180 == PL_ROTATION_90) {
|
||||
/* Libplacebo expects the input crop relative to the actual frame
|
||||
* dimensions, so un-transpose them here */
|
||||
FFSWAP(float, image->crop.x0, image->crop.y0);
|
||||
FFSWAP(float, image->crop.x1, image->crop.y1);
|
||||
}
|
||||
|
||||
if (src == ref) {
|
||||
/* Only update the target crop once, for the 'reference' frame */
|
||||
target->crop.x0 = av_expr_eval(s->pos_x_pexpr, s->var_values, NULL);
|
||||
@@ -928,12 +924,17 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
|
||||
target->crop.x1 = target->crop.x0 + s->var_values[VAR_POS_W];
|
||||
target->crop.y1 = target->crop.y0 + s->var_values[VAR_POS_H];
|
||||
|
||||
|
||||
/* Effective visual crop */
|
||||
const float w_adj = av_q2d(inlink->sample_aspect_ratio) /
|
||||
av_q2d(outlink->sample_aspect_ratio);
|
||||
double sar_in = q2d_fallback(inlink->sample_aspect_ratio, 1.0);
|
||||
double sar_out = q2d_fallback(outlink->sample_aspect_ratio, 1.0);
|
||||
|
||||
pl_rotation rot_total = PL_ROTATION_360 + image->rotation - target->rotation;
|
||||
if (rot_total % PL_ROTATION_180 == PL_ROTATION_90)
|
||||
sar_in = 1.0 / sar_in;
|
||||
|
||||
pl_rect2df fixed = image->crop;
|
||||
pl_rect2df_stretch(&fixed, w_adj, 1.0);
|
||||
pl_rect2df_stretch(&fixed, sar_in / sar_out, 1.0);
|
||||
|
||||
switch (s->fit_mode) {
|
||||
case FIT_FILL:
|
||||
@@ -955,6 +956,13 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
|
||||
case FIT_SCALE_DOWN:
|
||||
pl_rect2df_aspect_fit(&target->crop, &fixed, 0.0);
|
||||
}
|
||||
|
||||
if (rot_total % PL_ROTATION_180 == PL_ROTATION_90) {
|
||||
/* Libplacebo expects the input crop relative to the actual frame
|
||||
* dimensions, so un-transpose them here */
|
||||
FFSWAP(float, image->crop.x0, image->crop.y0);
|
||||
FFSWAP(float, image->crop.x1, image->crop.y1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1278,7 +1286,7 @@ static int libplacebo_activate(AVFilterContext *ctx)
|
||||
in->qstatus = pl_queue_update(in->queue, &in->mix, pl_queue_params(
|
||||
.pts = TS2T(out_pts, outlink->time_base),
|
||||
.radius = pl_frame_mix_radius(&s->opts->params),
|
||||
.vsync_duration = l->frame_rate.num ? av_q2d(av_inv_q(l->frame_rate)) : 0,
|
||||
.vsync_duration = q2d_fallback(av_inv_q(l->frame_rate), 0.0),
|
||||
));
|
||||
|
||||
switch (in->qstatus) {
|
||||
@@ -1461,8 +1469,7 @@ static int libplacebo_config_output(AVFilterLink *outlink)
|
||||
&outlink->w, &outlink->h));
|
||||
|
||||
s->reset_sar |= s->normalize_sar || s->nb_inputs > 1;
|
||||
double sar_in = inlink->sample_aspect_ratio.num ?
|
||||
av_q2d(inlink->sample_aspect_ratio) : 1.0;
|
||||
double sar_in = q2d_fallback(inlink->sample_aspect_ratio, 1.0);
|
||||
|
||||
int force_oar = s->force_original_aspect_ratio;
|
||||
if (!force_oar && s->fit_sense == FIT_CONSTRAINT) {
|
||||
@@ -1549,8 +1556,7 @@ static int libplacebo_config_output(AVFilterLink *outlink)
|
||||
/* Static variables */
|
||||
s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = outlink->w;
|
||||
s->var_values[VAR_OUT_H] = s->var_values[VAR_OH] = outlink->h;
|
||||
s->var_values[VAR_DAR] = outlink->sample_aspect_ratio.num ?
|
||||
av_q2d(outlink->sample_aspect_ratio) : 1.0;
|
||||
s->var_values[VAR_DAR] = q2d_fallback(outlink->sample_aspect_ratio, 1.0);
|
||||
s->var_values[VAR_HSUB] = 1 << desc->log2_chroma_w;
|
||||
s->var_values[VAR_VSUB] = 1 << desc->log2_chroma_h;
|
||||
s->var_values[VAR_OHSUB] = 1 << out_desc->log2_chroma_w;
|
||||
|
||||
@@ -78,9 +78,10 @@ void ff_multiply3x3_sse2(int16_t *data[3], ptrdiff_t stride, int w, int h,
|
||||
|
||||
void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp)
|
||||
{
|
||||
#if ARCH_X86_64
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags)) {
|
||||
if (EXTERNAL_SSE2(cpu_flags)) {
|
||||
#define assign_yuv2yuv_fns(ss) \
|
||||
dsp->yuv2yuv[BPP_8 ][BPP_8 ][SS_##ss] = ff_yuv2yuv_##ss##p8to8_sse2; \
|
||||
dsp->yuv2yuv[BPP_8 ][BPP_10][SS_##ss] = ff_yuv2yuv_##ss##p8to10_sse2; \
|
||||
@@ -116,4 +117,5 @@ void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp)
|
||||
|
||||
dsp->multiply3x3 = ff_multiply3x3_sse2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -30,12 +30,14 @@ double ff_ebur128_find_peak_2ch_avx(double *, int, const double *, int);
|
||||
|
||||
av_cold void ff_ebur128_init_x86(EBUR128DSPContext *dsp, int nb_channels)
|
||||
{
|
||||
#if ARCH_X86_64
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (ARCH_X86_64 && EXTERNAL_AVX(cpu_flags)) {
|
||||
if (EXTERNAL_AVX(cpu_flags)) {
|
||||
if (nb_channels >= 2)
|
||||
dsp->filter_channels = ff_ebur128_filter_channels_avx;
|
||||
if (nb_channels == 2)
|
||||
dsp->find_peak = ff_ebur128_find_peak_2ch_avx;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -36,15 +36,17 @@ void ff_atadenoise_filter_row8_serial_sse4(const uint8_t *src, uint8_t *dst,
|
||||
|
||||
av_cold void ff_atadenoise_init_x86(ATADenoiseDSPContext *dsp, int depth, int algorithm, const float *sigma)
|
||||
{
|
||||
#if ARCH_X86_64
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
for (int p = 0; p < 4; p++) {
|
||||
if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == PARALLEL && sigma[p] == INT16_MAX) {
|
||||
if (EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == PARALLEL && sigma[p] == INT16_MAX) {
|
||||
dsp->filter_row[p] = ff_atadenoise_filter_row8_sse4;
|
||||
}
|
||||
|
||||
if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == SERIAL && sigma[p] == INT16_MAX) {
|
||||
if (EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == SERIAL && sigma[p] == INT16_MAX) {
|
||||
dsp->filter_row[p] = ff_atadenoise_filter_row8_serial_sse4;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -67,18 +67,22 @@ av_cold void ff_bwdif_init_x86(BWDIFDSPContext *bwdif, int bit_depth)
|
||||
bwdif->filter_line = ff_bwdif_filter_line_sse2;
|
||||
if (EXTERNAL_SSSE3(cpu_flags))
|
||||
bwdif->filter_line = ff_bwdif_filter_line_ssse3;
|
||||
if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags))
|
||||
#if ARCH_X86_64
|
||||
if (EXTERNAL_AVX2_FAST(cpu_flags))
|
||||
bwdif->filter_line = ff_bwdif_filter_line_avx2;
|
||||
if (ARCH_X86_64 && EXTERNAL_AVX512ICL(cpu_flags))
|
||||
if (EXTERNAL_AVX512ICL(cpu_flags))
|
||||
bwdif->filter_line = ff_bwdif_filter_line_avx512icl;
|
||||
#endif
|
||||
} else if (bit_depth <= 12) {
|
||||
if (EXTERNAL_SSE2(cpu_flags))
|
||||
bwdif->filter_line = ff_bwdif_filter_line_12bit_sse2;
|
||||
if (EXTERNAL_SSSE3(cpu_flags))
|
||||
bwdif->filter_line = ff_bwdif_filter_line_12bit_ssse3;
|
||||
if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags))
|
||||
#if ARCH_X86_64
|
||||
if (EXTERNAL_AVX2_FAST(cpu_flags))
|
||||
bwdif->filter_line = ff_bwdif_filter_line_12bit_avx2;
|
||||
if (ARCH_X86_64 && EXTERNAL_AVX512ICL(cpu_flags))
|
||||
if (EXTERNAL_AVX512ICL(cpu_flags))
|
||||
bwdif->filter_line = ff_bwdif_filter_line_12bit_avx512icl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,10 @@ void ff_compute_weights_line_avx2(const uint32_t *const iia,
|
||||
|
||||
av_cold void ff_nlmeans_init_x86(NLMeansDSPContext *dsp)
|
||||
{
|
||||
#if ARCH_X86_64
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags))
|
||||
if (EXTERNAL_AVX2_FAST(cpu_flags))
|
||||
dsp->compute_weights_line = ff_compute_weights_line_avx2;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -34,8 +34,10 @@ void ff_ssim_init_x86(SSIMDSPContext *dsp)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (ARCH_X86_64 && EXTERNAL_SSSE3(cpu_flags))
|
||||
#if ARCH_X86_64
|
||||
if (EXTERNAL_SSSE3(cpu_flags))
|
||||
dsp->ssim_4x4_line = ff_ssim_4x4_line_ssse3;
|
||||
#endif
|
||||
if (EXTERNAL_SSE4(cpu_flags))
|
||||
dsp->ssim_end_line = ff_ssim_end_line_sse4;
|
||||
if (EXTERNAL_XOP(cpu_flags))
|
||||
|
||||
@@ -56,7 +56,9 @@ av_cold void ff_w3fdif_init_x86(W3FDIFDSPContext *dsp, int depth)
|
||||
dsp->filter_scale = ff_w3fdif_scale_sse2;
|
||||
}
|
||||
|
||||
if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags) && depth <= 8) {
|
||||
#if ARCH_X86_64
|
||||
if (EXTERNAL_SSE2(cpu_flags) && depth <= 8) {
|
||||
dsp->filter_complex_high = ff_w3fdif_complex_high_sse2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user