[FFmpeg-cvslog] Changelog: Add Support hevc,vp9,av1 codec in enhanced flv format
ffmpeg | branch: master | Steven Liu | Mon Aug 14 15:20:00 2023 +0800| [a1928dff2c498ab9439d997bdc93fc98d2862cb0] | committer: Steven Liu Changelog: Add Support hevc,vp9,av1 codec in enhanced flv format Signed-off-by: Steven Liu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1928dff2c498ab9439d997bdc93fc98d2862cb0 --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index fa48d2811f..3d20acc44a 100644 --- a/Changelog +++ b/Changelog @@ -28,6 +28,7 @@ version : - scale_vt filter for videotoolbox - transpose_vt filter for videotoolbox - support for the P_SKIP hinting to speed up libx264 encoding +- Support HEVC,VP9,AV1 codec in enhanced flv format version 6.0: - Radiance HDR image support ___ 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] avfilter: add apsnr filter
ffmpeg | branch: master | Paul B Mahol | Sun Aug 13 02:57:57 2023 +0200| [951def850abe9dc77311e5afd4b581defa1575bb] | committer: Paul B Mahol avfilter: add apsnr filter > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=951def850abe9dc77311e5afd4b581defa1575bb --- doc/filters.texi | 7 + libavfilter/Makefile | 1 + libavfilter/af_asdr.c| 67 +--- libavfilter/allfilters.c | 1 + 4 files changed, 73 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 43e9c037b9..5d1f10f95d 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -2836,6 +2836,13 @@ Default value is 8. This filter supports the all above options as @ref{commands}. +@section apsnr +Measure Audio Peak Signal-to-Noise Ratio. + +This filter takes two audio streams for input, and outputs first +audio stream. +Results are in dB per channel at end of either input. + @section apsyclip Apply Psychoacoustic clipper to input audio stream. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 30a0e22ef8..9cd1407250 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -84,6 +84,7 @@ OBJS-$(CONFIG_APAD_FILTER) += af_apad.o OBJS-$(CONFIG_APERMS_FILTER) += f_perms.o OBJS-$(CONFIG_APHASER_FILTER)+= af_aphaser.o generate_wave_table.o OBJS-$(CONFIG_APHASESHIFT_FILTER)+= af_afreqshift.o +OBJS-$(CONFIG_APSNR_FILTER) += af_asdr.o OBJS-$(CONFIG_APSYCLIP_FILTER) += af_apsyclip.o OBJS-$(CONFIG_APULSATOR_FILTER) += af_apulsator.o OBJS-$(CONFIG_AREALTIME_FILTER) += f_realtime.o diff --git a/libavfilter/af_asdr.c b/libavfilter/af_asdr.c index 7d778b7f6b..b0401804f6 100644 --- a/libavfilter/af_asdr.c +++ b/libavfilter/af_asdr.c @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "libavutil/channel_layout.h" #include "libavutil/common.h" @@ -27,6 +29,8 @@ typedef struct AudioSDRContext { int channels; +uint64_t nb_samples; +double max; double *sum_u; double *sum_uv; @@ -67,6 +71,34 @@ static int sdr_##name(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)\ SDR_FILTER(fltp, float) SDR_FILTER(dblp, double) +#define PSNR_FILTER(name, type) \ +static int psnr_##name(AVFilterContext *ctx, void *arg, int jobnr,int nb_jobs)\ +{ \ +AudioSDRContext *s = ctx->priv; \ +AVFrame *u = s->cache[0]; \ +AVFrame *v = s->cache[1]; \ +const int channels = u->ch_layout.nb_channels;\ +const int start = (channels * jobnr) / nb_jobs; \ +const int end = (channels * (jobnr+1)) / nb_jobs; \ +const int nb_samples = u->nb_samples; \ + \ +for (int ch = start; ch < end; ch++) {\ +const type *const us = (type *)u->extended_data[ch]; \ +const type *const vs = (type *)v->extended_data[ch]; \ +double sum_uv = 0.; \ + \ +for (int n = 0; n < nb_samples; n++) \ +sum_uv += (us[n] - vs[n]) * (us[n] - vs[n]); \ + \ +s->sum_uv[ch] += sum_uv; \ +} \ + \ +return 0; \ +} + +PSNR_FILTER(fltp, float) +PSNR_FILTER(dblp, double) + static int activate(AVFilterContext *ctx) { AudioSDRContext *s = ctx->priv; @@ -97,6 +129,7 @@ static int activate(AVFilterContext *ctx) out = s->cache[0]; s->cache[0] = NULL; +s->nb_samples += available; return ff_filter_frame(outlink, out); } @@ -126,7 +159,12 @@ static int config_output(AVFilterLink *outlink) AudioSDRContext *s = ctx->priv; s->channels = inlink->ch_layout.nb_channels; -s->filter = inlink->format == AV_SAMPLE_FMT_FLTP ? sdr_fltp : sdr_dblp; + +if (!strcmp(ctx->filter->name, "asdr")) +s->filter = inlink->format == AV_SAMPLE_FMT_FLTP ? sdr_fltp : sdr_dblp; +else +s->filter = inlink->format == AV_SAM
[FFmpeg-cvslog] avfilter/af_asdr: use single structure for sums
ffmpeg | branch: master | Paul B Mahol | Sun Aug 13 05:03:00 2023 +0200| [10110a30b54c161fd267bb53b424b12aabdfcf70] | committer: Paul B Mahol avfilter/af_asdr: use single structure for sums > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=10110a30b54c161fd267bb53b424b12aabdfcf70 --- libavfilter/af_asdr.c | 44 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/libavfilter/af_asdr.c b/libavfilter/af_asdr.c index 53069427bf..dbbb7e3419 100644 --- a/libavfilter/af_asdr.c +++ b/libavfilter/af_asdr.c @@ -27,13 +27,18 @@ #include "filters.h" #include "internal.h" +typedef struct ChanStats { +double u; +double v; +double uv; +} ChanStats; + typedef struct AudioSDRContext { int channels; uint64_t nb_samples; double max; -double *sum_u; -double *sum_v; -double *sum_uv; + +ChanStats *chs; AVFrame *cache[2]; @@ -52,6 +57,7 @@ static int sdr_##name(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)\ const int nb_samples = u->nb_samples; \ \ for (int ch = start; ch < end; ch++) {\ +ChanStats *chs = &s->chs[ch]; \ const type *const us = (type *)u->extended_data[ch]; \ const type *const vs = (type *)v->extended_data[ch]; \ double sum_uv = 0.; \ @@ -62,8 +68,8 @@ static int sdr_##name(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)\ sum_uv += (us[n] - vs[n]) * (us[n] - vs[n]); \ } \ \ -s->sum_uv[ch] += sum_uv; \ -s->sum_u[ch] += sum_u; \ +chs->uv += sum_uv;\ +chs->u += sum_u; \ } \ \ return 0; \ @@ -84,6 +90,7 @@ static int sisdr_##name(AVFilterContext *ctx, void *arg,int jobnr,int nb_jobs)\ const int nb_samples = u->nb_samples; \ \ for (int ch = start; ch < end; ch++) {\ +ChanStats *chs = &s->chs[ch]; \ const type *const us = (type *)u->extended_data[ch]; \ const type *const vs = (type *)v->extended_data[ch]; \ double sum_uv = 0.; \ @@ -96,9 +103,9 @@ static int sisdr_##name(AVFilterContext *ctx, void *arg,int jobnr,int nb_jobs)\ sum_uv += us[n] * vs[n]; \ } \ \ -s->sum_uv[ch] += sum_uv; \ -s->sum_u[ch] += sum_u; \ -s->sum_v[ch] += sum_v; \ +chs->uv += sum_uv;\ +chs->u += sum_u; \ +chs->v += sum_v; \ } \ \ return 0; \ @@ -119,6 +126,7 @@ static int psnr_##name(AVFilterContext *ctx, void *arg, int jobnr,int nb_jobs)\ const int nb_samples = u->nb_samples; \ \ for (int ch = start; ch < end; ch++) {\ +ChanStats *chs = &s->chs[ch]; \ const type *const us = (type *)u->extended_data[ch]; \ const type *const vs = (type *)v->extended_data[ch]; \ double sum_uv = 0.; \ @@ -126,7 +134,7 @@ static int psnr_##name(AVFilterContext *ctx, void *arg, i
[FFmpeg-cvslog] avfilter: add asisdr filter
ffmpeg | branch: master | Paul B Mahol | Sun Aug 13 04:19:08 2023 +0200| [e41d52216cfe3537d7eadca863fb25838edd18c6] | committer: Paul B Mahol avfilter: add asisdr filter > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e41d52216cfe3537d7eadca863fb25838edd18c6 --- doc/filters.texi | 7 ++ libavfilter/Makefile | 1 + libavfilter/af_asdr.c| 64 +++- libavfilter/allfilters.c | 1 + 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 5d1f10f95d..cac1ee4381 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -3141,6 +3141,13 @@ audio, the data is treated as if all the planes were concatenated. A list of Adler-32 checksums for each data plane. @end table +@section asisdr +Measure Audio Scaled-Invariant Signal-to-Distortion Ratio. + +This filter takes two audio streams for input, and outputs first +audio stream. +Results are in dB per channel at end of either input. + @section asoftclip Apply audio soft clipping. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 9cd1407250..2fe0033b21 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -102,6 +102,7 @@ OBJS-$(CONFIG_ASETRATE_FILTER) += af_asetrate.o OBJS-$(CONFIG_ASETTB_FILTER) += settb.o OBJS-$(CONFIG_ASHOWINFO_FILTER) += af_ashowinfo.o OBJS-$(CONFIG_ASIDEDATA_FILTER) += f_sidedata.o +OBJS-$(CONFIG_ASISDR_FILTER) += af_asdr.o OBJS-$(CONFIG_ASOFTCLIP_FILTER) += af_asoftclip.o OBJS-$(CONFIG_ASPECTRALSTATS_FILTER) += af_aspectralstats.o OBJS-$(CONFIG_ASPLIT_FILTER) += split.o diff --git a/libavfilter/af_asdr.c b/libavfilter/af_asdr.c index b0401804f6..53069427bf 100644 --- a/libavfilter/af_asdr.c +++ b/libavfilter/af_asdr.c @@ -32,6 +32,7 @@ typedef struct AudioSDRContext { uint64_t nb_samples; double max; double *sum_u; +double *sum_v; double *sum_uv; AVFrame *cache[2]; @@ -71,6 +72,41 @@ static int sdr_##name(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)\ SDR_FILTER(fltp, float) SDR_FILTER(dblp, double) +#define SISDR_FILTER(name, type) \ +static int sisdr_##name(AVFilterContext *ctx, void *arg,int jobnr,int nb_jobs)\ +{ \ +AudioSDRContext *s = ctx->priv; \ +AVFrame *u = s->cache[0]; \ +AVFrame *v = s->cache[1]; \ +const int channels = u->ch_layout.nb_channels;\ +const int start = (channels * jobnr) / nb_jobs; \ +const int end = (channels * (jobnr+1)) / nb_jobs; \ +const int nb_samples = u->nb_samples; \ + \ +for (int ch = start; ch < end; ch++) {\ +const type *const us = (type *)u->extended_data[ch]; \ +const type *const vs = (type *)v->extended_data[ch]; \ +double sum_uv = 0.; \ +double sum_u = 0.;\ +double sum_v = 0.;\ + \ +for (int n = 0; n < nb_samples; n++) {\ +sum_u += us[n] * us[n]; \ +sum_v += vs[n] * vs[n]; \ +sum_uv += us[n] * vs[n]; \ +} \ + \ +s->sum_uv[ch] += sum_uv; \ +s->sum_u[ch] += sum_u; \ +s->sum_v[ch] += sum_v; \ +} \ + \ +return 0; \ +} + +SISDR_FILTER(fltp, float) +SISDR_FILTER(dblp, double) + #define PSNR_FILTER(name, type) \ static int psnr_##name(AVFilterContext *ctx, void *arg, int jobnr,int nb_jobs)\ { \ @@ -162,13 +198,16 @@ static int config_output(A
[FFmpeg-cvslog] avfilter/af_asdr: remove wrong scaling from sdr, and fix sisdr formula
ffmpeg | branch: master | Paul B Mahol | Mon Aug 14 01:36:34 2023 +0200| [24c013369dee69b87b517d6a7d71644d094a4e46] | committer: Paul B Mahol avfilter/af_asdr: remove wrong scaling from sdr, and fix sisdr formula > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24c013369dee69b87b517d6a7d71644d094a4e46 --- libavfilter/af_asdr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_asdr.c b/libavfilter/af_asdr.c index dbbb7e3419..3942f48053 100644 --- a/libavfilter/af_asdr.c +++ b/libavfilter/af_asdr.c @@ -225,11 +225,11 @@ static av_cold void uninit(AVFilterContext *ctx) if (!strcmp(ctx->filter->name, "asdr")) { for (int ch = 0; ch < s->channels; ch++) -av_log(ctx, AV_LOG_INFO, "SDR ch%d: %g dB\n", ch, 20. * log10(s->chs[ch].u / s->chs[ch].uv)); +av_log(ctx, AV_LOG_INFO, "SDR ch%d: %g dB\n", ch, 10. * log10(s->chs[ch].u / s->chs[ch].uv)); } else if (!strcmp(ctx->filter->name, "asisdr")) { for (int ch = 0; ch < s->channels; ch++) { double scale = s->chs[ch].uv / s->chs[ch].v; -double sisdr = s->chs[ch].u / fmax(0., s->chs[ch].u + scale*scale*s->chs[ch].v - 2.0*scale*s->chs[ch].uv); +double sisdr = scale * scale * s->chs[ch].v / fmax(0., s->chs[ch].u + scale*scale*s->chs[ch].v - 2.0*scale*s->chs[ch].uv); av_log(ctx, AV_LOG_INFO, "SI-SDR ch%d: %g dB\n", ch, 10. * log10(sisdr)); } ___ 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] Bump minor libavfilter version and add Changelog entry
ffmpeg | branch: master | Paul B Mahol | Mon Aug 14 11:24:12 2023 +0200| [c7049013247ac6c4851cf1b4ad6e22f0461a775a] | committer: Paul B Mahol Bump minor libavfilter version and add Changelog entry > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c7049013247ac6c4851cf1b4ad6e22f0461a775a --- Changelog | 2 ++ libavfilter/version.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 3d20acc44a..c010e86159 100644 --- a/Changelog +++ b/Changelog @@ -29,6 +29,8 @@ version : - transpose_vt filter for videotoolbox - support for the P_SKIP hinting to speed up libx264 encoding - Support HEVC,VP9,AV1 codec in enhanced flv format +- apsnr and asisdr audio filters + version 6.0: - Radiance HDR image support diff --git a/libavfilter/version.h b/libavfilter/version.h index 4a69d6be98..8f4a7a9cd3 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -31,7 +31,7 @@ #include "version_major.h" -#define LIBAVFILTER_VERSION_MINOR 10 +#define LIBAVFILTER_VERSION_MINOR 11 #define LIBAVFILTER_VERSION_MICRO 100 ___ 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] configure: Set WIN32_LEAN_AND_MEAN at configure time
ffmpeg | branch: master | L. E. Segovia | Mon Aug 14 08:53:37 2023 -0300| [ddc1cd5cdd2570bf3d6ab807ee0ecfacdf09431d] | committer: Martin Storsjö configure: Set WIN32_LEAN_AND_MEAN at configure time Including winsock2.h or windows.h without WIN32_LEAN_AND_MEAN cause bzlib.h to parse as nonsense, due to an instance of #define char small in rpcndr.h. See: https://stackoverflow.com/a/27794577 Signed-off-by: L. E. Segovia Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ddc1cd5cdd2570bf3d6ab807ee0ecfacdf09431d --- compat/atomics/win32/stdatomic.h | 1 - compat/w32pthreads.h | 1 - configure| 3 +++ libavdevice/dshow_capture.h | 1 - libavdevice/opengl_enc.c | 1 - libavfilter/vsrc_ddagrab.c | 1 - libavformat/os_support.c | 6 ++ libavutil/wchar_filename.h | 1 - libswscale/utils.c | 1 - 9 files changed, 5 insertions(+), 11 deletions(-) diff --git a/compat/atomics/win32/stdatomic.h b/compat/atomics/win32/stdatomic.h index 28a627bfd3..4f8ac2bb60 100644 --- a/compat/atomics/win32/stdatomic.h +++ b/compat/atomics/win32/stdatomic.h @@ -19,7 +19,6 @@ #ifndef COMPAT_ATOMICS_WIN32_STDATOMIC_H #define COMPAT_ATOMICS_WIN32_STDATOMIC_H -#define WIN32_LEAN_AND_MEAN #include #include #include diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h index dae8d9420d..2ff9735227 100644 --- a/compat/w32pthreads.h +++ b/compat/w32pthreads.h @@ -35,7 +35,6 @@ * As most functions here are used without checking return values, * only implement return values as necessary. */ -#define WIN32_LEAN_AND_MEAN #include #include #include diff --git a/configure b/configure index 932998b8d6..ff6a5c3600 100755 --- a/configure +++ b/configure @@ -5666,6 +5666,7 @@ case $target_os in fi ! enabled small && test_cmd $windres --version && enable gnu_windres enabled x86_32 && check_ldflags -Wl,--large-address-aware +add_cppflags -DWIN32_LEAN_AND_MEAN shlibdir_default="$bindir_default" SLIBPREF="" SLIBSUF=".dll" @@ -5716,6 +5717,7 @@ case $target_os in fi ! enabled small && test_cmd $windres --version && enable gnu_windres enabled x86_32 && check_ldflags -LARGEADDRESSAWARE +add_cppflags -DWIN32_LEAN_AND_MEAN shlibdir_default="$bindir_default" SLIBPREF="" SLIBSUF=".dll" @@ -5745,6 +5747,7 @@ case $target_os in enabled x86_64 && objformat="win64" || objformat="win32" enable dos_paths ! enabled small && test_cmd $windres --version && enable gnu_windres +add_cppflags -DWIN32_LEAN_AND_MEAN add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 ;; *-dos|freedos|opendos) diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h index b548cd7afc..81e684b9be 100644 --- a/libavdevice/dshow_capture.h +++ b/libavdevice/dshow_capture.h @@ -27,7 +27,6 @@ #include "avdevice.h" #define COBJMACROS -#define WIN32_LEAN_AND_MEAN #include #define NO_DSHOW_STRSAFE #include diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c index f9dc846bf1..1b0cf5aa8f 100644 --- a/libavdevice/opengl_enc.c +++ b/libavdevice/opengl_enc.c @@ -30,7 +30,6 @@ #include "config.h" #if HAVE_WINDOWS_H -#define WIN32_LEAN_AND_MEAN #include #endif #if HAVE_OPENGL_GL3_H diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index b65261f685..c3107e11b4 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -22,7 +22,6 @@ #undef _WIN32_WINNT #define _WIN32_WINNT 0x0A00 #endif -#define WIN32_LEAN_AND_MEAN #include diff --git a/libavformat/os_support.c b/libavformat/os_support.c index 15cea7fa5b..2de6a7c3d9 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -34,11 +34,9 @@ #if HAVE_SYS_TIME_H #include #endif /* HAVE_SYS_TIME_H */ -#if HAVE_WINSOCK2_H -#include -#elif HAVE_SYS_SELECT_H +#if HAVE_SYS_SELECT_H #include -#endif /* HAVE_WINSOCK2_H */ +#endif /* HAVE_SYS_SELECT_H */ #endif /* !HAVE_POLL_H */ #include "network.h" diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h index fbc0a55146..4f87e6f88b 100644 --- a/libavutil/wchar_filename.h +++ b/libavutil/wchar_filename.h @@ -21,7 +21,6 @@ #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN #include #include "mem.h" diff --git a/libswscale/utils.c b/libswscale/utils.c index 8fe34a3437..8e74c6603e 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -34,7 +34,6 @@ #endif #endif #if HAVE_VIRTUALALLOC -#define WIN32_LEAN_AND_MEAN #include #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/wavpack: remove hard limitation on number of supported channels
ffmpeg | branch: master | Paul B Mahol | Tue Aug 15 00:12:52 2023 +0200| [46412a8935e4632b2460988bfce4152c7dccce22] | committer: Paul B Mahol avcodec/wavpack: remove hard limitation on number of supported channels > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46412a8935e4632b2460988bfce4152c7dccce22 --- libavcodec/wavpack.c | 20 +--- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 4346304f54..71e7d40c81 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -96,12 +96,10 @@ typedef struct WavpackFrameContext { uint8_t *value_lookup[MAX_HISTORY_BINS]; } WavpackFrameContext; -#define WV_MAX_FRAME_DECODERS 14 - typedef struct WavpackContext { AVCodecContext *avctx; -WavpackFrameContext *fdec[WV_MAX_FRAME_DECODERS]; +WavpackFrameContext **fdec; int fdec_num; int block; @@ -971,7 +969,8 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, static av_cold int wv_alloc_frame_context(WavpackContext *c) { -if (c->fdec_num == WV_MAX_FRAME_DECODERS) +c->fdec = av_realloc_f(c->fdec, c->fdec_num + 1, sizeof(*c->fdec)); +if (!c->fdec) return -1; c->fdec[c->fdec_num] = av_mallocz(sizeof(**c->fdec)); @@ -1064,6 +1063,7 @@ static av_cold int wavpack_decode_end(AVCodecContext *avctx) for (int i = 0; i < s->fdec_num; i++) av_freep(&s->fdec[i]); +av_freep(&s->fdec); s->fdec_num = 0; ff_thread_release_ext_buffer(avctx, &s->curr_frame); @@ -1415,18 +1415,12 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no, size = bytestream2_get_byte(&gb); chan |= (bytestream2_get_byte(&gb) & 0xF) << 8; chan += 1; -if (avctx->ch_layout.nb_channels != chan) -av_log(avctx, AV_LOG_WARNING, "%i channels signalled" - " instead of %i.\n", chan, avctx->ch_layout.nb_channels); chmask = bytestream2_get_le24(&gb); break; case 5: size = bytestream2_get_byte(&gb); chan |= (bytestream2_get_byte(&gb) & 0xF) << 8; chan += 1; -if (avctx->ch_layout.nb_channels != chan) -av_log(avctx, AV_LOG_WARNING, "%i channels signalled" - " instead of %i.\n", chan, avctx->ch_layout.nb_channels); chmask = bytestream2_get_le32(&gb); break; default: @@ -1519,11 +1513,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no, return AVERROR_INVALIDDATA; } } else { -ret = av_channel_layout_copy(&new_ch_layout, &avctx->ch_layout); -if (ret < 0) { -av_log(avctx, AV_LOG_ERROR, "Error copying channel layout\n"); -return ret; -} +av_channel_layout_default(&new_ch_layout, chan); } } else { av_channel_layout_default(&new_ch_layout, s->stereo + 1); ___ 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/wavpackenc: add support for encoding unspec channel layouts
ffmpeg | branch: master | Paul B Mahol | Tue Aug 15 00:27:40 2023 +0200| [a3b434e1515ecb0de0c4b92c6b7659e510b980c2] | committer: Paul B Mahol avcodec/wavpackenc: add support for encoding unspec channel layouts Also write 0 for chmask if mask have bits outside of first 32 bits, as wavpack does not support more bits than 32 for channel layouts. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a3b434e1515ecb0de0c4b92c6b7659e510b980c2 --- libavcodec/wavpackenc.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c index 9271e87990..33a5dfcc89 100644 --- a/libavcodec/wavpackenc.c +++ b/libavcodec/wavpackenc.c @@ -2592,7 +2592,16 @@ static int wavpack_encode_block(WavPackEncodeContext *s, s->avctx->ch_layout.u.mask != AV_CH_LAYOUT_STEREO) { put_metadata_block(&pb, WP_ID_CHANINFO, 5); bytestream2_put_byte(&pb, s->avctx->ch_layout.nb_channels); -bytestream2_put_le32(&pb, s->avctx->ch_layout.u.mask); +if (s->avctx->ch_layout.u.mask >> 32) +bytestream2_put_le32(&pb, 0); +else +bytestream2_put_le32(&pb, s->avctx->ch_layout.u.mask); +bytestream2_put_byte(&pb, 0); +} else if (s->flags & WV_INITIAL_BLOCK && + s->avctx->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) { +put_metadata_block(&pb, WP_ID_CHANINFO, 5); +bytestream2_put_byte(&pb, s->avctx->ch_layout.nb_channels); +bytestream2_put_le32(&pb, 0); bytestream2_put_byte(&pb, 0); } ___ 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".