[FFmpeg-devel] [PATCH 1/2] avcodec/hcadec: fix decoding of hfr channels
I suspect this was originally broken by b7e5c8f , but even then, it only worked because it read out of bounds from intensity_ratio_table. Signed-off-by: t --- libavcodec/hca_data.h | 14 -- libavcodec/hcadec.c | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libavcodec/hca_data.h b/libavcodec/hca_data.h index 80b4a794dc..7093221c2a 100644 --- a/libavcodec/hca_data.h +++ b/libavcodec/hca_data.h @@ -86,18 +86,18 @@ static const float intensity_ratio_table[] = { 2.0, 1.85714, 1.71429, 1.57143, 1.42857, 1.28571, 1.14286, 1.0, 0.857143, 0.714286, 0.571429, 0.428571, 0.285714, 0.142857, 0.0, 0.0, -0, 1.87066e-08, 2.49253e-08, 3.32113e-08, 4.42518e-08, 5.89626e-08, 7.85637e-08, 1.04681e-07, +}; + +static const float scale_conversion_table[] = +{ +0, 0, 1.87066e-08, 2.49253e-08, 3.32113e-08, 4.42518e-08, 5.89626e-08, 7.85637e-08, 1.04681e-07, 1.3948e-07, 1.85848e-07, 2.4763e-07, 3.2995e-07, 4.39636e-07, 5.85785e-07, 7.80519e-07, 1.03999e-06, 1.38572e-06, 1.84637e-06, 2.46017e-06, 3.27801e-06, 4.36772e-06, 5.8197e-06, 7.75435e-06, 1.03321e-05, 1.37669e-05, 1.83435e-05, 2.44414e-05, 3.25665e-05, 4.33927e-05, 5.78179e-05, 7.70384e-05, 0.000102648, 0.000136772, 0.00018224, 0.000242822, 0.000323544, 0.000431101, 0.000574413, 0.000765366, 0.0010198, 0.00135881, 0.00181053, 0.0024124, 0.00321437, 0.00428293, 0.00570671, 0.00760381, 0.0101316, 0.0134996, 0.0179873, 0.0239669, 0.0319343, 0.0425503, 0.0566954, 0.0755428, 0.100656, -0.134117, 0.178702, 0.238108, 0.317263, 0.422731, 0.563261, 0.750507, 0.0, -}; - -static const float scale_conversion_table[] = -{ +0.134117, 0.178702, 0.238108, 0.317263, 0.422731, 0.563261, 0.750507, 1.0, 1.33243, 1.77538, 2.36557, 3.15196, 4.19978, 5.59592, 7.45618, 9.93486, 13.2375, 17.6381, 23.5016, 31.3143, 41.7242, 55.5947, 74.0762, 98.7015, 131.513, 175.232, 233.485, 311.103, 414.524, 552.326, 735.937, @@ -108,6 +108,8 @@ static const float scale_conversion_table[] = 9.55285e+06, 1.27285e+07, 1.69599e+07, 2.25979e+07, 3.01102e+07, 4.01198e+07, 5.3457e+07, 0, }; +static const int scale_conv_bias = 64; + static const float dequantizer_scaling_table[] = { 1.58838e-07, 2.11641e-07, 2.81998e-07, 3.75743e-07, 5.00652e-07, 6.67085e-07, 8.88846e-07, 1.18433e-06, diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c index 5fa87319d2..a890e75a13 100644 --- a/libavcodec/hcadec.c +++ b/libavcodec/hcadec.c @@ -287,7 +287,8 @@ static void reconstruct_hfr(HCAContext *s, ChannelContext *ch, for (int i = 0, k = start_band, l = start_band - 1; i < hfr_group_count; i++){ for (int j = 0; j < bands_per_hfr_group && k < total_band_count && l >= 0; j++, k++, l--){ -ch->imdct_in[k] = scale_conversion_table[ (ch->hfr_scale[i] - ch->scale_factors[l]) & 63 ] * ch->imdct_in[l]; +ch->imdct_in[k] = scale_conversion_table[ scale_conv_bias + +av_clip_intp2(ch->hfr_scale[i] - ch->scale_factors[l], 6) ] * ch->imdct_in[l]; } } -- 2.25.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avcodec/hcadec: get intensity from correct channel
Fixes an issue with one output channel being slightly louder than the other. The output now matches other public HCA decoders. Signed-off-by: t --- libavcodec/hcadec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c index a890e75a13..28e7d07cec 100644 --- a/libavcodec/hcadec.c +++ b/libavcodec/hcadec.c @@ -263,7 +263,7 @@ static void apply_intensity_stereo(HCAContext *s, ChannelContext *ch1, ChannelCo int index, unsigned band_count, unsigned base_band_count, unsigned stereo_band_count) { -float ratio_l = intensity_ratio_table[ch1->intensity[index]]; +float ratio_l = intensity_ratio_table[ch2->intensity[index]]; float ratio_r = ratio_l - 2.0f; float *c1 = &ch1->imdct_in[base_band_count]; float *c2 = &ch2->imdct_in[base_band_count]; -- 2.25.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] fix decoding HE-AAC mono streams
Hi, this patch fix decoding HE-AAC mono streams. ffmpeg -f lavfi -i anullsrc -c:a libfdk_aac -profile:a aac_he -ac 1 -f adts - | ffmpeg -i - now: ffmpeg shows HE-AACv2 (but HE-AACv2 needs stereo because of Parametric Stereo) with patch: ffmpeg shows HE-AAC correctly Thomas --- libavcodec/aacdec_template.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 6bc94c8..2b38553 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -2326,7 +2326,7 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, av_log(ac->avctx, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n"); skip_bits_long(gb, 8 * cnt - 4); return res; -} else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && ac->avctx->channels == 1) { +} else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && ac->avctx->channels == 2) { ac->oc[1].m4ac.sbr = 1; ac->oc[1].m4ac.ps = 1; ac->avctx->profile = FF_PROFILE_AAC_HE_V2; -- 1.7.10.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/unix: Set is_streamed to true
That sounds perfectly fine with me. Thanks for the quick reply. On Thursday, February 6, 2025, Leo Izen wrote: > On 2/6/25 2:00 AM, dank074 wrote: > >> Currently when a Unix Domain Socket is used as input there is a loss of >> data when data is consumed from the stream. Setting is_streamed to true >> fixes this, since the unix domain socket is now treated like a consumable >> stream. >> >> Fixes: #9346 >> Signed-off-by: dank074 >> --- >> libavformat/unix.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavformat/unix.c b/libavformat/unix.c >> index 5704155cf0..2de4023835 100644 >> --- a/libavformat/unix.c >> +++ b/libavformat/unix.c >> @@ -89,7 +89,7 @@ static int unix_open(URLContext *h, const char >> *filename, int flags) >> } >> s->fd = fd; >> - >> +h->is_streamed = 1; >> return 0; >> fail: >> > > The patch looks fine as-is but two style nitpicks: > > - we like to have a full blank line between the return statement and the > one before it, so you should add this line of code right after the line > s->fd = fd; but not remove the blank line that was there > - commit messages should be capped at 72 characters per line for > historical reasons, so please insert newline characters in the commit > message > > If there's no other objections I will push this patch and make both of > these changes on my end, preserving authorship before I do, if that is okay > with you. > > - Leo Izen (Traneptora) > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] fix: 'make' with mingw32
>From 48e4da7d6476ac2a62cc462478b8ccf4d0c45361 Mon Sep 17 00:00:00 2001 From: Youka Date: Tue, 12 Aug 2014 04:32:02 +0200 Subject: [PATCH] fix: 'make' with mingw32 Older mingw32 compilers (not mingw-64, but tdm [default by IDE C::B]) don't auto-include pthread headers, so struct timespec & nanosleep are missing for compilation of libavutil/time.c. --- libavutil/time.c | 4 1 file changed, 4 insertions(+) diff --git a/libavutil/time.c b/libavutil/time.c index ce4552e..a286fca 100644 --- a/libavutil/time.c +++ b/libavutil/time.c @@ -31,6 +31,10 @@ #endif #if HAVE_WINDOWS_H #include +#if HAVE_NANOSLEEP +#include +#include +#endif #endif #include "time.h" -- 1.8.4.msysgit.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] ffmpeg_opt.c wrong parameter for Filter
use the ost->enc_ctx->channel_layout for f->channel_layout not f->channel_layout = av_get_default_channel_layout(ost->enc_ctx->channels); ffmpeg_opt.c static int open_output_file(OptionsContext *o, const char *filename) Old: if (ost->enc_ctx->channels) { f->channel_layout = av_get_default_channel_layout(ost->enc_ctx->channels); } else if (ost->enc->channel_layouts) { count = 0; while (ost->enc->channel_layouts[count]) count++; f->channel_layouts = av_mallocz_array(count + 1, sizeof(*f->channel_layouts)); if (!f->channel_layouts) exit_program(1); memcpy(f->channel_layouts, ost->enc->channel_layouts, (count + 1) * sizeof(*f->channel_layouts)); } new: if (ost->enc_ctx->channel_layout) { f->channel_layout = ost->enc_ctx->channel_layout; } else if (ost->enc_ctx->channels) { f->channel_layout = av_get_default_channel_layout(ost->enc_ctx->channels); } else if (ost->enc->channel_layouts) { count = 0; while (ost->enc->channel_layouts[count]) count++; f->channel_layouts = av_mallocz_array(count + 1, sizeof(*f->channel_layouts)); if (!f->channel_layouts) exit_program(1); memcpy(f->channel_layouts, ost->enc->channel_layouts, (count + 1) * sizeof(*f->channel_layouts)); } ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel