This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 5bd86141b64981bc049f8244863c777b27490961 Author: Kacper Michajłow <[email protected]> AuthorDate: Tue Aug 11 12:14:02 2026 +0200 Commit: Kacper Michajłow <[email protected]> CommitDate: Sun Sep 6 00:48:25 2026 +0200 avcodec/dsd: add helper for DSD to PCM conversion via libswresample libswresample now supports AV_SAMPLE_FMT_DSD input using the same conversion as the local dsd2pcm implementation. This will be used in following commits and replace dsd2pcm impl. Signed-off-by: Kacper Michajłow <[email protected]> --- configure | 1 + libavcodec/dsd.c | 30 ++++++++++++++++++++++++++++++ libavcodec/dsd.h | 11 +++++++++++ 3 files changed, 42 insertions(+) diff --git a/configure b/configure index 512192bec5..c025dbc95d 100755 --- a/configure +++ b/configure @@ -8403,6 +8403,7 @@ enabled zoompan_filter && prepend avfilter_deps "swscale" enabled lavfi_indev && prepend avdevice_deps "avfilter" enabled opus_decoder && prepend avcodec_deps "swresample" +enabled swresample && enabled_any dsd_lsbf_decoder dsd_lsbf_planar_decoder dsd_msbf_decoder dsd_msbf_planar_decoder dst_decoder wavpack_decoder && prepend avcodec_deps "swresample" # reorder the items at var $1 to align with the items order at var $2 . # die if an item at $1 is not at $2 . diff --git a/libavcodec/dsd.c b/libavcodec/dsd.c index 1093c5e2dd..bca8b3e3a4 100644 --- a/libavcodec/dsd.c +++ b/libavcodec/dsd.c @@ -21,6 +21,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" + #include <string.h> #include "libavutil/attributes.h" #include "libavutil/reverse.h" @@ -132,3 +134,31 @@ void ff_dsd2pcm_translate(DSDContext* s, size_t samples, int lsbf, s->pos = pos; memcpy(s->buf, buf, sizeof(buf)); } + +#if CONFIG_SWRESAMPLE +#include "libswresample/swresample.h" +#include "avcodec.h" + +av_cold int ff_dsd_to_pcm_init(AVCodecContext *avctx, struct SwrContext **swrp) +{ + SwrContext *swr = NULL; + int ret; + + swr_free(swrp); + + ret = swr_alloc_set_opts2(&swr, &avctx->ch_layout, avctx->sample_fmt, + avctx->sample_rate, &avctx->ch_layout, + AV_SAMPLE_FMT_DSD, avctx->sample_rate, 0, avctx); + if (ret < 0) + return ret; + + ret = swr_init(swr); + if (ret < 0) { + swr_free(&swr); + return ret; + } + + *swrp = swr; + return 0; +} +#endif diff --git a/libavcodec/dsd.h b/libavcodec/dsd.h index 74da74fccc..69c6c5bd43 100644 --- a/libavcodec/dsd.h +++ b/libavcodec/dsd.h @@ -48,4 +48,15 @@ void ff_init_dsd_data(void); void ff_dsd2pcm_translate(DSDContext* s, size_t samples, int lsbf, const uint8_t *src, ptrdiff_t src_stride, float *dst, ptrdiff_t dst_stride); + +struct AVCodecContext; +struct SwrContext; + +/** + * (Re)create a libswresample context converting AV_SAMPLE_FMT_DSD to + * avctx->sample_fmt at the same sample rate. + * Only available if CONFIG_SWRESAMPLE. + */ +int ff_dsd_to_pcm_init(struct AVCodecContext *avctx, struct SwrContext **swrp); + #endif /* AVCODEC_DSD_H */ -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
