[FFmpeg-cvslog] configure: Alphabetical order for av1 codecs
ffmpeg | branch: master | Fei Wang | Fri Jun 14 16:28:53 2024 +0800| [cf9c398fc1c4efc53c0fdd9cd6a8099b9b2d4012] | committer: Haihao Xiang configure: Alphabetical order for av1 codecs Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf9c398fc1c4efc53c0fdd9cd6a8099b9b2d4012 --- configure | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/configure b/configure index f6f5c29fea..a222d91dbd 100755 --- a/configure +++ b/configure @@ -3324,12 +3324,18 @@ nvenc_deps_any="libdl LoadLibrary" aac_mf_encoder_deps="mediafoundation" ac3_mf_encoder_deps="mediafoundation" +av1_amf_encoder_deps="amf" av1_cuvid_decoder_deps="cuvid CUVIDAV1PICPARAMS" av1_mediacodec_decoder_deps="mediacodec" av1_mediacodec_encoder_deps="mediacodec" av1_mediacodec_encoder_select="extract_extradata_bsf" av1_nvenc_encoder_deps="nvenc NV_ENC_PIC_PARAMS_AV1" av1_nvenc_encoder_select="atsc_a53" +av1_qsv_decoder_select="qsvdec" +av1_qsv_encoder_deps="libvpl" +av1_qsv_encoder_select="qsvenc" +av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1" +av1_vaapi_encoder_select="cbs_av1 vaapi_encode" h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m" h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m" h264_amf_encoder_deps="amf" @@ -3419,12 +3425,6 @@ vp9_vaapi_encoder_select="vaapi_encode" vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9" vp9_qsv_encoder_select="qsvenc" vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m" -av1_qsv_decoder_select="qsvdec" -av1_qsv_encoder_select="qsvenc" -av1_qsv_encoder_deps="libvpl" -av1_amf_encoder_deps="amf" -av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1" -av1_vaapi_encoder_select="cbs_av1 vaapi_encode" # parsers aac_parser_select="adts_header mpeg4audio" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/qsvdec: Add VVC decoder
ffmpeg | branch: master | Fei Wang | Fri Jun 14 16:28:54 2024 +0800| [d30a9fdc809c90fa39549e7dc9f040824488999a] | committer: Haihao Xiang lavc/qsvdec: Add VVC decoder Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d30a9fdc809c90fa39549e7dc9f040824488999a --- Changelog | 2 ++ configure | 1 + doc/decoders.texi | 2 +- libavcodec/allcodecs.c | 1 + libavcodec/qsv.c | 4 libavcodec/qsvdec.c| 7 ++- libavcodec/version.h | 2 +- 7 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index 3708e35a2a..571b27ad98 100644 --- a/Changelog +++ b/Changelog @@ -17,6 +17,8 @@ version : - perlin video source - D3D12VA HEVC encoder - Cropping metadata parsing and writing in Matroska and MP4/MOV de/muxers +- Intel QSV-accelerated VVC decoding + version 7.0: - DXV DXT1 encoder diff --git a/configure b/configure index a222d91dbd..770a637aad 100755 --- a/configure +++ b/configure @@ -3425,6 +3425,7 @@ vp9_vaapi_encoder_select="vaapi_encode" vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9" vp9_qsv_encoder_select="qsvenc" vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m" +vvc_qsv_decoder_select="qsvdec" # parsers aac_parser_select="adts_header mpeg4audio" diff --git a/doc/decoders.texi b/doc/decoders.texi index 293c82c2ba..2fcc761d2f 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -157,7 +157,7 @@ Force to use a specific number of threads @section QSV Decoders The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC, -JPEG/MJPEG, VP8, VP9, AV1). +JPEG/MJPEG, VP8, VP9, AV1, VVC). @subsection Common Options diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 9598e0fea2..09385be4ee 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -887,6 +887,7 @@ extern const FFCodec ff_vp9_mediacodec_encoder; extern const FFCodec ff_vp9_qsv_decoder; extern const FFCodec ff_vp9_vaapi_encoder; extern const FFCodec ff_vp9_qsv_encoder; +extern const FFCodec ff_vvc_qsv_decoder; // null codecs extern const FFCodec ff_vnull_decoder; diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 0c6fbd0dc0..221c1b24e5 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -73,6 +73,10 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id) case AV_CODEC_ID_AV1: return MFX_CODEC_AV1; #endif +#if QSV_VERSION_ATLEAST(2, 11) +case AV_CODEC_ID_VVC: +return MFX_CODEC_VVC; +#endif default: break; diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index f2cd6ae05c..9ad3439991 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -933,7 +933,8 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q, frame->pict_type = ff_qsv_map_pictype(aframe.frame->dec_info.FrameType); if (avctx->codec_id == AV_CODEC_ID_H264 || -avctx->codec_id == AV_CODEC_ID_HEVC) { +avctx->codec_id == AV_CODEC_ID_HEVC || +avctx->codec_id == AV_CODEC_ID_VVC) { if (aframe.frame->dec_info.FrameType & MFX_FRAMETYPE_IDR) frame->flags |= AV_FRAME_FLAG_KEY; else @@ -1300,3 +1301,7 @@ DEFINE_QSV_DECODER(vp9, VP9, NULL) #if CONFIG_AV1_QSV_DECODER DEFINE_QSV_DECODER(av1, AV1, NULL) #endif + +#if CONFIG_VVC_QSV_DECODER +DEFINE_QSV_DECODER(vvc, VVC, NULL) +#endif diff --git a/libavcodec/version.h b/libavcodec/version.h index 80e2ae630d..8b53586be1 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 10 +#define LIBAVCODEC_VERSION_MINOR 11 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavu/hwcontext_qsv: Derive bind flag from frame type if no valid surface
ffmpeg | branch: master | Fei Wang | Tue Jul 23 09:27:02 2024 +0800| [79b486995993061ed169d647c3d5d829743f52f1] | committer: Haihao Xiang lavu/hwcontext_qsv: Derive bind flag from frame type if no valid surface Fix cmd: ffmpeg.exe -init_hw_device d3d11va=d3d -init_hw_device qsv=qsv@d3d \ -filter_hw_device d3d -hwaccel qsv -hwaccel_output_format qsv \ -i in.h264 -vf "hwmap,format=d3d11,hwdownload,format=nv12" -y out.yuv Signed-off-by: Fei Wang Tested-by: Tong Wu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=79b486995993061ed169d647c3d5d829743f52f1 --- libavutil/hwcontext_qsv.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 7cec347478..09156275ec 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -1549,8 +1549,11 @@ static int qsv_frames_derive_from(AVHWFramesContext *dst_ctx, dst_hwctx->texture_infos[i].texture = (ID3D11Texture2D*)pair->first; dst_hwctx->texture_infos[i].index = pair->second == (mfxMemId)MFX_INFINITE ? (intptr_t)0 : (intptr_t)pair->second; } -ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture, &texDesc); -dst_hwctx->BindFlags = texDesc.BindFlags; +if (src_hwctx->nb_surfaces) { +ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture, &texDesc); +dst_hwctx->BindFlags = texDesc.BindFlags; +} else +dst_hwctx->BindFlags = qsv_get_d3d11va_bind_flags(src_hwctx->frame_type); } break; #endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/pngdec: use 8-bit sBIT cap for indexed PNGs per spec
ffmpeg | branch: master | Leo Izen | Fri Jul 19 12:04:19 2024 -0400| [825606641b11f3f1f5c5efb0f95501b2c2d34d50] | committer: Leo Izen avcodec/pngdec: use 8-bit sBIT cap for indexed PNGs per spec The PNG specification[1] says that sBIT entries must be at most the bit depth specified in IHDR, unless the PNG is indexed-color, in which case sBIT must be between 1 and 8. We should not reject valid sBITs on PNGs with indexed color. [1]: https://www.w3.org/TR/png-3/#11sBIT Regression since 84b454935fae2633a8a5dd075e22393f3e8f932f. Signed-off-by: Leo Izen Reported-by: Ramiro Polla > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=825606641b11f3f1f5c5efb0f95501b2c2d34d50 --- libavcodec/pngdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index cb861e5f60..c5b32c166d 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1097,7 +1097,7 @@ static int decode_sbit_chunk(AVCodecContext *avctx, PNGDecContext *s, bits = FFMAX(b, bits); } -if (bits < 0 || bits > s->bit_depth) { +if (bits <= 0 || bits > (s->color_type & PNG_COLOR_MASK_PALETTE ? 8 : s->bit_depth)) { av_log(avctx, AV_LOG_ERROR, "Invalid significant bits: %d\n", bits); return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/pngenc: fix sBIT writing for indexed-color PNGs
ffmpeg | branch: master | Leo Izen | Fri Jul 19 12:04:20 2024 -0400| [7bb5626fa7754b37932dfa11d497b7101c55291a] | committer: Leo Izen avcodec/pngenc: fix sBIT writing for indexed-color PNGs We currently write invalid sBIT entries for indexed PNGs, which by PNG specification[1] must be 3-bytes long. The values also are capped at 8 for indexed-color PNGs, not the palette depth. This patch fixes both of these issues previously fixed in the decoder, but not the encoder. [1]: https://www.w3.org/TR/png-3/#11sBIT Regression since: c125860892e931d9b10f88ace73c91484815c3a8. Signed-off-by: Leo Izen Reported-by: Ramiro Polla: > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7bb5626fa7754b37932dfa11d497b7101c55291a --- libavcodec/pngenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 7ae16fa2c5..cb79c04e11 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -469,8 +469,9 @@ static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) if (png_get_gama(pict->color_trc, s->buf)) png_write_chunk(&s->bytestream, MKTAG('g', 'A', 'M', 'A'), s->buf, 4); -if (avctx->bits_per_raw_sample > 0 && avctx->bits_per_raw_sample < s->bit_depth) { -int len = ff_png_get_nb_channels(s->color_type); +if (avctx->bits_per_raw_sample > 0 && +avctx->bits_per_raw_sample < (s->color_type & PNG_COLOR_MASK_PALETTE ? 8 : s->bit_depth)) { +int len = s->color_type & PNG_COLOR_MASK_PALETTE ? 3 : ff_png_get_nb_channels(s->color_type); memset(s->buf, avctx->bits_per_raw_sample, len); png_write_chunk(&s->bytestream, MKTAG('s', 'B', 'I', 'T'), s->buf, len); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/aacenc: Correct option description for aac_coder fast
ffmpeg | branch: master | Marth64 | Sun Jul 14 00:00:35 2024 -0500| [e2105b2800d99cf878c8bf7ed56e7162fca2952e] | committer: Leo Izen avcodec/aacenc: Correct option description for aac_coder fast The description advertises fast as "Default fast search", but this has not been the default for a long time (current default is twoloop). Signed-off-by: Marth64 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2105b2800d99cf878c8bf7ed56e7162fca2952e --- libavcodec/aacenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 163598e938..88037c7f87 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -1392,7 +1392,7 @@ static const AVOption aacenc_options[] = { {"aac_coder", "Coding algorithm", offsetof(AACEncContext, options.coder), AV_OPT_TYPE_INT, {.i64 = AAC_CODER_TWOLOOP}, 0, AAC_CODER_NB-1, AACENC_FLAGS, .unit = "coder"}, {"anmr", "ANMR method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_ANMR},INT_MIN, INT_MAX, AACENC_FLAGS, .unit = "coder"}, {"twoloop", "Two loop searching method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_TWOLOOP}, INT_MIN, INT_MAX, AACENC_FLAGS, .unit = "coder"}, -{"fast", "Default fast search", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_FAST},INT_MIN, INT_MAX, AACENC_FLAGS, .unit = "coder"}, +{"fast", "Fast search", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_FAST},INT_MIN, INT_MAX, AACENC_FLAGS, .unit = "coder"}, {"aac_ms", "Force M/S stereo coding", offsetof(AACEncContext, options.mid_side), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, AACENC_FLAGS}, {"aac_is", "Intensity stereo coding", offsetof(AACEncContext, options.intensity_stereo), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, AACENC_FLAGS}, {"aac_pns", "Perceptual noise substitution", offsetof(AACEncContext, options.pns), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, AACENC_FLAGS}, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/pngenc: fix sBIT writing for indexed-color PNGs
ffmpeg | branch: release/7.0 | Leo Izen | Fri Jul 19 12:04:20 2024 -0400| [0ab20b5788d08f1947a6351e048fcdbc2838fc49] | committer: Leo Izen avcodec/pngenc: fix sBIT writing for indexed-color PNGs We currently write invalid sBIT entries for indexed PNGs, which by PNG specification[1] must be 3-bytes long. The values also are capped at 8 for indexed-color PNGs, not the palette depth. This patch fixes both of these issues previously fixed in the decoder, but not the encoder. [1]: https://www.w3.org/TR/png-3/#11sBIT Regression since: c125860892e931d9b10f88ace73c91484815c3a8. Signed-off-by: Leo Izen Reported-by: Ramiro Polla: > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ab20b5788d08f1947a6351e048fcdbc2838fc49 --- libavcodec/pngenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index e4c6bdc563..819cd83659 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -468,8 +468,9 @@ static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) if (png_get_gama(pict->color_trc, s->buf)) png_write_chunk(&s->bytestream, MKTAG('g', 'A', 'M', 'A'), s->buf, 4); -if (avctx->bits_per_raw_sample > 0 && avctx->bits_per_raw_sample < s->bit_depth) { -int len = ff_png_get_nb_channels(s->color_type); +if (avctx->bits_per_raw_sample > 0 && +avctx->bits_per_raw_sample < (s->color_type & PNG_COLOR_MASK_PALETTE ? 8 : s->bit_depth)) { +int len = s->color_type & PNG_COLOR_MASK_PALETTE ? 3 : ff_png_get_nb_channels(s->color_type); memset(s->buf, avctx->bits_per_raw_sample, len); png_write_chunk(&s->bytestream, MKTAG('s', 'B', 'I', 'T'), s->buf, len); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/pngdec: use 8-bit sBIT cap for indexed PNGs per spec
ffmpeg | branch: release/7.0 | Leo Izen | Fri Jul 19 12:04:19 2024 -0400| [63e90b338c85813b5b8e55deb2abf90d6edd931a] | committer: Leo Izen avcodec/pngdec: use 8-bit sBIT cap for indexed PNGs per spec The PNG specification[1] says that sBIT entries must be at most the bit depth specified in IHDR, unless the PNG is indexed-color, in which case sBIT must be between 1 and 8. We should not reject valid sBITs on PNGs with indexed color. [1]: https://www.w3.org/TR/png-3/#11sBIT Regression since 84b454935fae2633a8a5dd075e22393f3e8f932f. Signed-off-by: Leo Izen Reported-by: Ramiro Polla > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=63e90b338c85813b5b8e55deb2abf90d6edd931a --- libavcodec/pngdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index ac39b3277b..ea586332b2 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1095,7 +1095,7 @@ static int decode_sbit_chunk(AVCodecContext *avctx, PNGDecContext *s, bits = FFMAX(b, bits); } -if (bits < 0 || bits > s->bit_depth) { +if (bits <= 0 || bits > (s->color_type & PNG_COLOR_MASK_PALETTE ? 8 : s->bit_depth)) { av_log(avctx, AV_LOG_ERROR, "Invalid significant bits: %d\n", bits); return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/pngenc: fix sBIT writing for indexed-color PNGs
ffmpeg | branch: release/6.1 | Leo Izen | Fri Jul 19 12:04:20 2024 -0400| [0bd31a8f91bb65b370bbe9234e2636a1f359a4cd] | committer: Leo Izen avcodec/pngenc: fix sBIT writing for indexed-color PNGs We currently write invalid sBIT entries for indexed PNGs, which by PNG specification[1] must be 3-bytes long. The values also are capped at 8 for indexed-color PNGs, not the palette depth. This patch fixes both of these issues previously fixed in the decoder, but not the encoder. [1]: https://www.w3.org/TR/png-3/#11sBIT Regression since: c125860892e931d9b10f88ace73c91484815c3a8. Signed-off-by: Leo Izen Reported-by: Ramiro Polla: > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0bd31a8f91bb65b370bbe9234e2636a1f359a4cd --- libavcodec/pngenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index f0650962d2..f570ed5d08 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -442,8 +442,9 @@ static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) if (png_get_gama(pict->color_trc, s->buf)) png_write_chunk(&s->bytestream, MKTAG('g', 'A', 'M', 'A'), s->buf, 4); -if (avctx->bits_per_raw_sample > 0 && avctx->bits_per_raw_sample < s->bit_depth) { -int len = ff_png_get_nb_channels(s->color_type); +if (avctx->bits_per_raw_sample > 0 && +avctx->bits_per_raw_sample < (s->color_type & PNG_COLOR_MASK_PALETTE ? 8 : s->bit_depth)) { +int len = s->color_type & PNG_COLOR_MASK_PALETTE ? 3 : ff_png_get_nb_channels(s->color_type); memset(s->buf, avctx->bits_per_raw_sample, len); png_write_chunk(&s->bytestream, MKTAG('s', 'B', 'I', 'T'), s->buf, len); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/pngdec: use 8-bit sBIT cap for indexed PNGs per spec
ffmpeg | branch: release/6.1 | Leo Izen | Fri Jul 19 12:04:19 2024 -0400| [6662b0cdd12c01b9020e6dd73f8fef3a071df790] | committer: Leo Izen avcodec/pngdec: use 8-bit sBIT cap for indexed PNGs per spec The PNG specification[1] says that sBIT entries must be at most the bit depth specified in IHDR, unless the PNG is indexed-color, in which case sBIT must be between 1 and 8. We should not reject valid sBITs on PNGs with indexed color. [1]: https://www.w3.org/TR/png-3/#11sBIT Regression since 84b454935fae2633a8a5dd075e22393f3e8f932f. Signed-off-by: Leo Izen Reported-by: Ramiro Polla > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6662b0cdd12c01b9020e6dd73f8fef3a071df790 --- libavcodec/pngdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 4b6fc4471f..d418986b3e 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1036,7 +1036,7 @@ static int decode_sbit_chunk(AVCodecContext *avctx, PNGDecContext *s, bits = FFMAX(b, bits); } -if (bits < 0 || bits > s->bit_depth) { +if (bits <= 0 || bits > (s->color_type & PNG_COLOR_MASK_PALETTE ? 8 : s->bit_depth)) { av_log(avctx, AV_LOG_ERROR, "Invalid significant bits: %d\n", bits); return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/adpcm: only process right samples when decoding stereo
ffmpeg | branch: master | Peter Ross | Wed Jul 24 16:44:57 2024 +1000| [0e09f6d690b748f61d652ad58ed96c2d48670110] | committer: Peter Ross avcodec/adpcm: only process right samples when decoding stereo Fixes Coverity issue #1610760. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e09f6d690b748f61d652ad58ed96c2d48670110 --- libavcodec/adpcm.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 0a9780317c..8d358bc414 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1680,22 +1680,24 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame, for (int count2 = 0; count2 < (channels == 2 ? 28 : 14); count2++) { byte = bytestream2_get_byteu(&gb); next_left_sample = sign_extend(byte >> 4, 4) * (1 << shift_left); -next_right_sample = sign_extend(byte, 4) * (1 << shift_right); next_left_sample = (next_left_sample + (current_left_sample * coeff1l) + (previous_left_sample * coeff2l) + 0x80) >> 8; -next_right_sample = (next_right_sample + -(current_right_sample * coeff1r) + -(previous_right_sample * coeff2r) + 0x80) >> 8; previous_left_sample = current_left_sample; current_left_sample = av_clip_int16(next_left_sample); -previous_right_sample = current_right_sample; -current_right_sample = av_clip_int16(next_right_sample); *samples++ = current_left_sample; if (channels == 2){ +next_right_sample = sign_extend(byte, 4) * (1 << shift_right); + +next_right_sample = (next_right_sample + +(current_right_sample * coeff1r) + +(previous_right_sample * coeff2r) + 0x80) >> 8; + +previous_right_sample = current_right_sample; +current_right_sample = av_clip_int16(next_right_sample); *samples++ = current_right_sample; } else { next_left_sample = sign_extend(byte, 4) * (1 << shift_left); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavu/riscv: count bytes rather than words for bswap32
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Jul 27 14:55:04 2024 +0300| [bd0c3edb136fb79a8d99fd0dfc50c15e40a2355b] | committer: Rémi Denis-Courmont lavu/riscv: count bytes rather than words for bswap32 This removes the dependency on Zba at essentially zero cost. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd0c3edb136fb79a8d99fd0dfc50c15e40a2355b --- libavcodec/riscv/bswapdsp_init.c | 8 libavcodec/riscv/bswapdsp_rvb.S | 3 ++- libavutil/riscv/bswap_rvb.S | 10 +- libswscale/riscv/rgb2rgb.c | 2 +- libswscale/riscv/rgb2rgb_rvb.S | 3 +-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libavcodec/riscv/bswapdsp_init.c b/libavcodec/riscv/bswapdsp_init.c index d490c434e7..c13387c232 100644 --- a/libavcodec/riscv/bswapdsp_init.c +++ b/libavcodec/riscv/bswapdsp_init.c @@ -33,15 +33,15 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) #if HAVE_RV int flags = av_get_cpu_flags(); -if (flags & AV_CPU_FLAG_RVB_ADDR) { #if (__riscv_xlen >= 64) -if (flags & AV_CPU_FLAG_RVB_BASIC) -c->bswap_buf = ff_bswap32_buf_rvb; +if (flags & AV_CPU_FLAG_RVB_BASIC) +c->bswap_buf = ff_bswap32_buf_rvb; #endif #if HAVE_RVV +if (flags & AV_CPU_FLAG_RVB_ADDR) { if (flags & AV_CPU_FLAG_RVV_I32) c->bswap16_buf = ff_bswap16_buf_rvv; -#endif } #endif +#endif } diff --git a/libavcodec/riscv/bswapdsp_rvb.S b/libavcodec/riscv/bswapdsp_rvb.S index 52b6cd0d7b..8c7c791fe1 100644 --- a/libavcodec/riscv/bswapdsp_rvb.S +++ b/libavcodec/riscv/bswapdsp_rvb.S @@ -23,8 +23,9 @@ #include "libavutil/riscv/bswap_rvb.S" #if (__riscv_xlen >= 64) -func ff_bswap32_buf_rvb, zba, zbb +func ff_bswap32_buf_rvb, zbb lpad0 +sllia2, a2, 2 bswap32_rvb a0, a1, a2 endfunc #endif diff --git a/libavutil/riscv/bswap_rvb.S b/libavutil/riscv/bswap_rvb.S index 3ff53ccb56..bc07779c44 100644 --- a/libavutil/riscv/bswap_rvb.S +++ b/libavutil/riscv/bswap_rvb.S @@ -20,21 +20,21 @@ #if (__riscv_xlen >= 64) .macro bswap32_rvb out, in, count -andit0, \count, 4 +andit0, \count, 1 beqzt0, 1f /* Align input to 64-bit */ lwu t0, (\in) addi\out, \out, 4 rev8t0, t0 -addi\count, \count, -1 +addi\count, \count, -4 srlit0, t0, __riscv_xlen - 32 addi\in, \in, 4 sw t0, -4(\out) 1: -andit3, \count, -2 -sh2add \count, \count, \out +andit3, \count, -8 +add \count, \count, \out beqzt3, 3f -sh2add t3, t3, \out +add t3, t3, \out 2: /* 2 elements (64 bits) at a time on a 64-bit boundary */ ld t0, (\in) addi\out, \out, 8 diff --git a/libswscale/riscv/rgb2rgb.c b/libswscale/riscv/rgb2rgb.c index e751e11075..fb527e2bbe 100644 --- a/libswscale/riscv/rgb2rgb.c +++ b/libswscale/riscv/rgb2rgb.c @@ -46,7 +46,7 @@ av_cold void rgb2rgb_init_riscv(void) int flags = av_get_cpu_flags(); #if (__riscv_xlen == 64) -if ((flags & AV_CPU_FLAG_RVB_BASIC) && (flags & AV_CPU_FLAG_RVB_ADDR)) +if (flags & AV_CPU_FLAG_RVB_BASIC) shuffle_bytes_3210 = ff_shuffle_bytes_3210_rvb; #endif #if HAVE_RVV diff --git a/libswscale/riscv/rgb2rgb_rvb.S b/libswscale/riscv/rgb2rgb_rvb.S index af9ce2d215..d441308249 100644 --- a/libswscale/riscv/rgb2rgb_rvb.S +++ b/libswscale/riscv/rgb2rgb_rvb.S @@ -23,9 +23,8 @@ #include "libavutil/riscv/bswap_rvb.S" #if (__riscv_xlen >= 64) -func ff_shuffle_bytes_3210_rvb, zba, zbb +func ff_shuffle_bytes_3210_rvb, zbb lpad0 -srlia2, a2, 2 bswap32_rvb a1, a0, a2 endfunc #endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vc1dsp: unify R-V V DC bypass functions
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Jul 27 18:34:58 2024 +0300| [784a72a116c29a38ec55ce81e165a29bdd00c497] | committer: Rémi Denis-Courmont lavc/vc1dsp: unify R-V V DC bypass functions > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=784a72a116c29a38ec55ce81e165a29bdd00c497 --- libavcodec/riscv/vc1dsp_rvv.S | 126 -- 1 file changed, 35 insertions(+), 91 deletions(-) diff --git a/libavcodec/riscv/vc1dsp_rvv.S b/libavcodec/riscv/vc1dsp_rvv.S index 5189d5e855..548ef9d3bf 100644 --- a/libavcodec/riscv/vc1dsp_rvv.S +++ b/libavcodec/riscv/vc1dsp_rvv.S @@ -21,101 +21,45 @@ #include "libavutil/riscv/asm.S" -func ff_vc1_inv_trans_8x8_dc_rvv, zve64x, zba +.macro inv_trans_dc rows, cols, w, mat_lmul, row_lmul +func ff_vc1_inv_trans_\cols\()x\rows\()_dc_rvv, zve64x, zba lpad0 -lht2, (a2) -vsetivli zero, 8, e8, mf2, ta, ma -vlse64.v v0, (a0), a1 -sh1addt2, t2, t2 -addi t2, t2, 1 -srai t2, t2, 1 -sh1addt2, t2, t2 -addi t2, t2, 16 -srai t2, t2, 5 -lit0, 8*8 -vsetvli zero, t0, e16, m8, ta, ma -vzext.vf2 v8, v0 -vadd.vx v8, v8, t2 -vmax.vx v8, v8, zero -vsetvli zero, zero, e8, m4, ta, ma -vnclipu.wiv0, v8, 0 -vsetivli zero, 8, e8, mf2, ta, ma -vsse64.v v0, (a0), a1 -ret -endfunc - -func ff_vc1_inv_trans_4x8_dc_rvv, zve32x, zba -lpad0 -lht2, (a2) -vsetivli zero, 8, e8, mf2, ta, ma -vlse32.v v0, (a0), a1 -slli t1, t2, 4 -add t2, t2, t1 -addi t2, t2, 4 -srai t2, t2, 3 -sh1addt2, t2, t2 -slli t2, t2, 2 -addi t2, t2, 64 -srai t2, t2, 7 -lit0, 4*8 -vsetvli zero, t0, e16, m4, ta, ma -vzext.vf2 v4, v0 -vadd.vx v4, v4, t2 -vmax.vx v4, v4, zero -vsetvli zero, zero, e8, m2, ta, ma -vnclipu.wiv0, v4, 0 -vsetivli zero, 8, e8, mf2, ta, ma -vsse32.v v0, (a0), a1 -ret -endfunc - -func ff_vc1_inv_trans_8x4_dc_rvv, zve64x, zba -lpad0 -lht2, (a2) -vsetivli zero, 4, e8, mf4, ta, ma -vlse64.v v0, (a0), a1 -sh1addt2, t2, t2 -addi t2, t2, 1 -srai t2, t2, 1 -slli t1, t2, 4 -add t2, t2, t1 -addi t2, t2, 64 -srai t2, t2, 7 -lit0, 8*4 -vsetvli zero, t0, e16, m4, ta, ma -vzext.vf2 v4, v0 -vadd.vx v4, v4, t2 -vmax.vx v4, v4, zero -vsetvli zero, zero, e8, m2, ta, ma -vnclipu.wiv0, v4, 0 -vsetivli zero, 4, e8, mf4, ta, ma -vsse64.v v0, (a0), a1 +lh t2, (a2) +li a4, 22 - (5 * \cols) / 4 +mul t2, t2, a4 +vsetivlizero, \rows, e8, m\row_lmul, ta, ma +vlse\w\().v v0, (a0), a1 +addit2, t2, 4 +li a5, 22 - (5 * \rows) / 4 +srait2, t2, 3 +mul t2, t2, a5 +.if \cols * \rows >= 32 +li t0, \cols * \rows +.endif +addit2, t2, 64 +srait2, t2, 7 +.if \rows * \cols == 64 +vsetvli zero, t0, e16, m8, ta, ma +.elseif \rows * \cols == 32 +vsetvli zero, t0, e16, m4, ta, ma +.else +vsetivlizero, \rows * \cols, e16, m2, ta, ma +.endif +vzext.vf2 v8, v0 +vadd.vx v8, v8, t2 +vmax.vx v8, v8, zero +vsetvli zero, zero, e8, m\mat_lmul, ta, ma +vnclipu.wi v0, v8, 0 +vsetivlizero, \rows, e8, m\row_lmul, ta, ma +vsse\w\().v v0, (a0), a1 ret endfunc +.endm -func ff_vc1_inv_trans_4x4_dc_rvv, zve32x -lpad0 -lht2, (a2) -vsetivli zero, 4, e8, mf4, ta, ma -vlse32.v v0, (a0), a1 -slli t1, t2, 4 -add t2, t2, t1 -addi t2, t2, 4 -srai t2, t2, 3 -slli t1, t2, 4 -add t2, t2, t1 -addi t2, t2, 64 -srai t2, t2, 7 -vsetivli zero, 4*4, e16, m2, ta, ma -vzext.vf2 v2, v0 -vadd.vx v2, v2, t2 -vmax.vx v2, v2, zero -vsetvli zero, zero, e8, m1, ta, ma -vnclipu.wiv0, v2, 0 -vsetivli zero, 4, e8, mf4, ta, ma -vsse32.v v0, (a0), a1 -ret -endfunc +inv_trans_dc 8, 8, 64, 4, f2 +inv_trans_dc 4, 8, 64, 2, f4 +inv_trans_dc 8, 4, 32, 2, f2 +inv_trans_dc 4, 4, 32, 1, f
[FFmpeg-cvslog] lavc/ac3dsp: fix R-V CPU requirements
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Jul 27 14:30:52 2024 +0300| [5171baa2289322d57aa36df321582719293f231c] | committer: Rémi Denis-Courmont lavc/ac3dsp: fix R-V CPU requirements It probably will not matter on any real hardware, but the Zbb optimisations do not require Zba. And then, we need HAVE_RVV to build the RVV stuff. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5171baa2289322d57aa36df321582719293f231c --- libavcodec/riscv/ac3dsp_init.c | 36 +--- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c index f66b6cac57..24b3881854 100644 --- a/libavcodec/riscv/ac3dsp_init.c +++ b/libavcodec/riscv/ac3dsp_init.c @@ -41,26 +41,32 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c) #if HAVE_RV int flags = av_get_cpu_flags(); -if (flags & AV_CPU_FLAG_RVB_BASIC) +if (flags & AV_CPU_FLAG_RVB_BASIC) { c->ac3_exponent_min = ff_ac3_exponent_min_rvb; -if (flags & AV_CPU_FLAG_RVV_I32) +c->extract_exponents = ff_extract_exponents_rvb; +} + +# if HAVE_RVV +if (flags & AV_CPU_FLAG_RVV_I32) { c->ac3_exponent_min = ff_ac3_exponent_min_rvv; -if (flags & AV_CPU_FLAG_RVB_ADDR) { -if (flags & AV_CPU_FLAG_RVB_BASIC) -c->extract_exponents = ff_extract_exponents_rvb; -# if HAVE_RV_ZVBB -if (flags & AV_CPU_FLAG_RV_ZVBB) -c->extract_exponents = ff_extract_exponents_rvvb; +if (flags & AV_CPU_FLAG_RVB) { +# if HAVE_RV_ZVBB +if (flags & AV_CPU_FLAG_RV_ZVBB) +c->extract_exponents = ff_extract_exponents_rvvb; +# endif +if (flags & AV_CPU_FLAG_RVV_F32) { +c->float_to_fixed24 = ff_float_to_fixed24_rvv; +c->sum_square_butterfly_float = +ff_sum_square_butterfly_float_rvv; +} +# if __riscv_xlen >= 64 +if (flags & AV_CPU_FLAG_RVV_I64) +c->sum_square_butterfly_int32 = +ff_sum_square_butterfly_int32_rvv; +# endif # endif -if (flags & AV_CPU_FLAG_RVV_F32) { -c->float_to_fixed24 = ff_float_to_fixed24_rvv; -c->sum_square_butterfly_float = ff_sum_square_butterfly_float_rvv; } -# if __riscv_xlen >= 64 -if (flags & AV_CPU_FLAG_RVV_I64) -c->sum_square_butterfly_int32 = ff_sum_square_butterfly_int32_rvv; -# endif } #endif } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vc1dsp: use saturating arithmetic for RVV inv_trans_dc
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Jul 27 18:31:07 2024 +0300| [324eba69f7193367a28f31411f5ded9d7eb2eb48] | committer: Rémi Denis-Courmont lavc/vc1dsp: use saturating arithmetic for RVV inv_trans_dc T-Head C908 (cycles): vc1dsp.vc1_inv_trans_4x4_dc_c: 113.7 vc1dsp.vc1_inv_trans_4x4_dc_rvv_i32: 46.5 (before) vc1dsp.vc1_inv_trans_4x4_dc_rvv_i32: 45.5 (after) vc1dsp.vc1_inv_trans_4x8_dc_c: 230.7 vc1dsp.vc1_inv_trans_4x8_dc_rvv_i32: 65.7 (before) vc1dsp.vc1_inv_trans_4x8_dc_rvv_i32: 52.5 (after) vc1dsp.vc1_inv_trans_8x4_dc_c: 246.7 vc1dsp.vc1_inv_trans_8x4_dc_rvv_i64: 56.7 (before) vc1dsp.vc1_inv_trans_8x4_dc_rvv_i64: 45.5 (after) vc1dsp.vc1_inv_trans_8x8_dc_c: 419.7 vc1dsp.vc1_inv_trans_8x8_dc_rvv_i64: 81.2 (before) vc1dsp.vc1_inv_trans_8x8_dc_rvv_i64: 53.5 (after) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=324eba69f7193367a28f31411f5ded9d7eb2eb48 --- libavcodec/riscv/vc1dsp_rvv.S | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libavcodec/riscv/vc1dsp_rvv.S b/libavcodec/riscv/vc1dsp_rvv.S index 548ef9d3bf..f9b59688ae 100644 --- a/libavcodec/riscv/vc1dsp_rvv.S +++ b/libavcodec/riscv/vc1dsp_rvv.S @@ -38,18 +38,20 @@ func ff_vc1_inv_trans_\cols\()x\rows\()_dc_rvv, zve64x, zba .endif addit2, t2, 64 srait2, t2, 7 -.if \rows * \cols == 64 -vsetvli zero, t0, e16, m8, ta, ma -.elseif \rows * \cols == 32 -vsetvli zero, t0, e16, m4, ta, ma +.if \rows * \cols >= 32 +vsetvli zero, t0, e8, m\mat_lmul, ta, ma .else -vsetivlizero, \rows * \cols, e16, m2, ta, ma +vsetivlizero, \rows * \cols, e8, m\mat_lmul, ta, ma .endif -vzext.vf2 v8, v0 -vadd.vx v8, v8, t2 -vmax.vx v8, v8, zero -vsetvli zero, zero, e8, m\mat_lmul, ta, ma -vnclipu.wi v0, v8, 0 +bgezt2, 1f + +neg t2, t2 +vssubu.vx v0, v0, t2 +vsetivlizero, \rows, e8, m\row_lmul, ta, ma +vsse\w\().v v0, (a0), a1 +ret +1: +vsaddu.vx v0, v0, t2 vsetivlizero, \rows, e8, m\row_lmul, ta, ma vsse\w\().v v0, (a0), a1 ret ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/videodsp: RISC-V zicbop prefetch
ffmpeg | branch: master | Rémi Denis-Courmont | Fri Sep 23 18:09:54 2022 +0300| [262168b04e6807fce6a78507c14cfc166ba72845] | committer: Rémi Denis-Courmont lavc/videodsp: RISC-V zicbop prefetch There are currently no ways to run-time detect the CPU capability, so we take it for granted (in the worst case, it will execute NOPs). > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=262168b04e6807fce6a78507c14cfc166ba72845 --- libavcodec/riscv/Makefile| 2 ++ libavcodec/riscv/videodsp.S | 34 ++ libavcodec/riscv/videodsp_init.c | 36 libavcodec/videodsp.c| 2 ++ libavcodec/videodsp.h| 1 + 5 files changed, 75 insertions(+) diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index a6cdcb71e9..1491b6c067 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -67,6 +67,8 @@ RVV-OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_rvv.o OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_init.o RV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvi.o RVV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvv.o +OBJS-$(CONFIG_VIDEODSP) += riscv/videodsp_init.o +RV-OBJS-$(CONFIG_VIDEODSP) += riscv/videodsp.o OBJS-$(CONFIG_VP7_DECODER) += riscv/vp7dsp_init.o RVV-OBJS-$(CONFIG_VP7_DECODER) += riscv/vp7dsp_rvv.o OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_init.o diff --git a/libavcodec/riscv/videodsp.S b/libavcodec/riscv/videodsp.S new file mode 100644 index 00..72bf70ec52 --- /dev/null +++ b/libavcodec/riscv/videodsp.S @@ -0,0 +1,34 @@ +/* + * Copyright © 2022 Rémi Denis-Courmont. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/riscv/asm.S" + +#if HAVE_RV_ZICBOP +func ff_prefetch_rv_zicbop, zicbop +1: +addia2, a2, -1 +prefetch.r (a0) +add a0, a0, a1 +bneza2, 1b + +ret +endfunc +#endif diff --git a/libavcodec/riscv/videodsp_init.c b/libavcodec/riscv/videodsp_init.c new file mode 100644 index 00..f2c9aae3ca --- /dev/null +++ b/libavcodec/riscv/videodsp_init.c @@ -0,0 +1,36 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavcodec/videodsp.h" + +void ff_prefetch_rv_zicbop(const uint8_t *mem, ptrdiff_t stride, int h); + +av_cold void ff_videodsp_init_riscv(VideoDSPContext *ctx, int bpc) +{ +#if HAVE_RV_ZICBOP +/* TODO: Since we pay for the indirect function call anyway, we should + * only set this if Cache-Block Operation Prefetch (Zicbop) is actually + * supported and otherwise save a few cycles of NOPs. + * But so far there are no means to detect Zicbop (in user mode). + */ +ctx->prefetch = ff_prefetch_rv_zicbop; +#endif +} diff --git a/libavcodec/videodsp.c b/libavcodec/videodsp.c index bdff2e76f5..a19e87a819 100644 --- a/libavcodec/videodsp.c +++ b/libavcodec/videodsp.c @@ -51,6 +51,8 @@ av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc) ff_videodsp_init_arm(ctx, bpc); #elif ARCH_PPC ff_videodsp_init_ppc(ctx, bpc); +#elif ARCH_RISCV +ff_videodsp_init_riscv(ctx, bpc); #elif ARCH_X86 ff_videodsp_init_x86(ctx, bpc); #elif ARCH_MIPS diff --git a/libavcodec/videodsp.h b/libavcodec/videodsp.h index e8960b609d..1be3188d09 100644 --- a/libavcodec/videodsp.h +++ b/libavcodec/videodsp.h @@ -81,6 +81,7 @@ void ff_videodsp_init(VideoDSPContext *ctx, int bpc); void ff_videodsp_init_aarch64(VideoDSPContext *ctx,
[FFmpeg-cvslog] configure: check if assembler supports RV zicbop
ffmpeg | branch: master | Rémi Denis-Courmont | Fri Sep 23 18:09:18 2022 +0300| [4570b9f3c4e64a996bcadc5af58574f7f32ee1de] | committer: Rémi Denis-Courmont configure: check if assembler supports RV zicbop zicbop is the Cache Block Operation, Prefetch extension to RVI. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4570b9f3c4e64a996bcadc5af58574f7f32ee1de --- configure | 4 1 file changed, 4 insertions(+) diff --git a/configure b/configure index 770a637aad..37178d7d81 100755 --- a/configure +++ b/configure @@ -2218,6 +2218,7 @@ ARCH_EXT_LIST_PPC=" ARCH_EXT_LIST_RISCV=" rv rvv +rv_zicbop rv_zvbb " @@ -2763,6 +2764,7 @@ power8_deps="vsx" rv_deps="riscv" rvv_deps="rv" +rv_zicbop="riscv" rv_zvbb_deps="rvv" loongson2_deps="mips" @@ -6366,6 +6368,7 @@ elif enabled riscv; then enabled rv && check_inline_asm rv '".option arch, +zbb\nrev8 t0, t1"' enabled rvv && check_inline_asm rvv '".option arch, +v\nvsetivli zero, 0, e8, m1, ta, ma"' +enabled rv_zicbop && check_inline_asm rv_zicbop '".option arch, +zicbop\nprefetch.r 64(a0)"' enabled rv_zvbb && check_inline_asm rv_zvbb '".option arch, +zvbb\nvclz.v v0, v8"' elif enabled x86; then @@ -7922,6 +7925,7 @@ if enabled loongarch; then echo "LASX enabled ${lasx-no}" fi if enabled riscv; then +echo "RISC-V CBO Prefetch ${rv_zicbop-no}" echo "RISC-V Vector enabled ${rvv-no}" fi echo "debug symbols ${debug-no}" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".