Re: [FFmpeg-devel] [EXTREMELY IMPORTANT] [PLEASE DO NOT IGNORE] [PATCH] avfilter/framesync: do not pick AV_TIME_BASE for time base when not needed.
On 2/2/20, Paul B Mahol wrote: > On 2/2/20, Nicolas George wrote: >> Paul B Mahol (12020-02-02): >>> I will repeat my last question once again, is it ok for you to check >>> that >>> all >>> input time-bases are same and that not AV_TIME_BASE is used in such >>> case? >> >> Already told you: waste of time. > > How so? I will write patch that fixes this. As unnecessary changing time-base is wrong way around. ___ 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 1/3] libfdk-aacdec: Apply the decoder's output delay on timestamps
The delay is normally zero when the level limiter is disabled, but if enabled, there's a small delay. --- libavcodec/libfdk-aacdec.c | 9 + 1 file changed, 9 insertions(+) diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c index 1abe1d8438..d9b080cf3e 100644 --- a/libavcodec/libfdk-aacdec.c +++ b/libavcodec/libfdk-aacdec.c @@ -57,6 +57,7 @@ typedef struct FDKAACDecContext { int drc_effect; int drc_cut; int level_limit; +int output_delay; } FDKAACDecContext; @@ -115,6 +116,9 @@ static int get_stream_info(AVCodecContext *avctx) } avctx->sample_rate = info->sampleRate; avctx->frame_size = info->frameSize; +#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10 +s->output_delay= info->outputDelay; +#endif for (i = 0; i < info->numChannels; i++) { AUDIO_CHANNEL_TYPE ctype = info->pChannelType[i]; @@ -367,6 +371,11 @@ static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) goto end; +if (frame->pts != AV_NOPTS_VALUE) +frame->pts -= av_rescale_q(s->output_delay, + (AVRational){1, avctx->sample_rate}, + avctx->time_base); + memcpy(frame->extended_data[0], s->decoder_buffer, avctx->channels * avctx->frame_size * av_get_bytes_per_sample(avctx->sample_fmt)); -- 2.21.1 (Apple Git-122.3) ___ 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 3/3] libfdk-aacdec: Allow explicitly disabling the DRC reference level option
Previously, it was always left in the automatic mode, if the option was set to the only special (negative) value. Now there's two separate special values for this option, -1 for automatic (metadata based) and -2 for explicitly disabled. --- libavcodec/libfdk-aacdec.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c index 32a97958c4..cc50fdce2f 100644 --- a/libavcodec/libfdk-aacdec.c +++ b/libavcodec/libfdk-aacdec.c @@ -76,8 +76,8 @@ static const AVOption fdk_aac_dec_options[] = { OFFSET(drc_boost), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, NULL}, { "drc_cut", "Dynamic Range Control: attenuation factor, where [0] is none and [127] is max compression", OFFSET(drc_cut),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, NULL}, -{ "drc_level", "Dynamic Range Control: reference level, quantized to 0.25dB steps where [0] is 0dB and [127] is -31.75dB", - OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 127, AD, NULL}, +{ "drc_level", "Dynamic Range Control: reference level, quantized to 0.25dB steps where [0] is 0dB and [127] is -31.75dB, -1 for auto, and -2 for disabled", + OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = -1}, -2, 127, AD, NULL}, { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on (RF mode) and [0] is off", OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, NULL}, #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10 @@ -298,6 +298,12 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx) } if (s->drc_level != -1) { +// This option defaults to -1, i.e. not calling +// aacDecoder_SetParam(AAC_DRC_REFERENCE_LEVEL) at all, which defaults +// to the level from DRC metadata, if available. The user can set +// -drc_level -2, which calls aacDecoder_SetParam( +// AAC_DRC_REFERENCE_LEVEL) with a negative value, which then +// explicitly disables the feature. if (aacDecoder_SetParam(s->handle, AAC_DRC_REFERENCE_LEVEL, s->drc_level) != AAC_DEC_OK) { av_log(avctx, AV_LOG_ERROR, "Unable to set DRC reference level in the decoder\n"); return AVERROR_UNKNOWN; -- 2.21.1 (Apple Git-122.3) ___ 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/3] libfdk-aacdec: Use the decoder's default level limiter settings
It was disabled by default in 2dbd35b00c6433e587d5f44d5dbc8972ebbaa88e as it added delay, but now we compensate for the delay properly by offsetting timestamps. --- libavcodec/libfdk-aacdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c index d9b080cf3e..32a97958c4 100644 --- a/libavcodec/libfdk-aacdec.c +++ b/libavcodec/libfdk-aacdec.c @@ -81,7 +81,7 @@ static const AVOption fdk_aac_dec_options[] = { { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on (RF mode) and [0] is off", OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, NULL}, #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10 -{ "level_limit", "Signal level limiting", OFFSET(level_limit), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 1, AD }, +{ "level_limit", "Signal level limiting (-1 auto, 0 off, 1 enabled)", OFFSET(level_limit), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, AD }, #endif #if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0 { "drc_effect","Dynamic Range Control: effect type, where e.g. [0] is none and [6] is general", -- 2.21.1 (Apple Git-122.3) ___ 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] vf_ssim: Fix loading doubles to float registers on i386
This fixes the tests filter-refcmp-ssim-yuv and filter-refcmp-ssim-rgb on i386 after breaking in fcc0424c933742c8fc852371e985d16b6eb4bfe9. --- libavfilter/x86/vf_ssim.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/x86/vf_ssim.asm b/libavfilter/x86/vf_ssim.asm index 1e682fe452..78809305de 100644 --- a/libavfilter/x86/vf_ssim.asm +++ b/libavfilter/x86/vf_ssim.asm @@ -255,6 +255,6 @@ cglobal ssim_end_line, 3, 3, 7, sum0, sum1, w addpd m0, m4 %if ARCH_X86_32 movsdr0m, m0 -fld r0mp +fldqword r0m %endif RET -- 2.21.1 (Apple Git-122.3) ___ 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".
Re: [FFmpeg-devel] [PATCH 2/3] libfdk-aacdec: Use the decoder's default level limiter settings
On 2/5/2020 8:07 AM, Martin Storsjö wrote: > It was disabled by default in 2dbd35b00c6433e587d5f44d5dbc8972ebbaa88e > as it added delay, but now we compensate for the delay properly > by offsetting timestamps. > --- > libavcodec/libfdk-aacdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c > index d9b080cf3e..32a97958c4 100644 > --- a/libavcodec/libfdk-aacdec.c > +++ b/libavcodec/libfdk-aacdec.c > @@ -81,7 +81,7 @@ static const AVOption fdk_aac_dec_options[] = { > { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is > on (RF mode) and [0] is off", > OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = > -1}, -1, 1, AD, NULL}, > #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10 > -{ "level_limit", "Signal level limiting", OFFSET(level_limit), > AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 1, AD }, > +{ "level_limit", "Signal level limiting (-1 auto, 0 off, 1 enabled)", > OFFSET(level_limit), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, AD }, AV_OPT_TYPE_BOOL. And there's no need for the explanation of each value here, just do it in decoders.texy. There are plenty such boolean options with the default being auto. > #endif > #if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0 > { "drc_effect","Dynamic Range Control: effect type, where e.g. [0] is > none and [6] is general", > ___ 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".
Re: [FFmpeg-devel] [PATCH 06/20] avformat/matroskaenc: Check functions that can fail
Andreas Rheinhardt: > Sometimes it has not been checked whether opening the dynamic buffer for > writing Tags fails; this might have led to segfaults. > > Signed-off-by: Andreas Rheinhardt > --- > libavformat/matroskaenc.c | 9 +++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c > index 8cea829b31..7857656309 100644 > --- a/libavformat/matroskaenc.c > +++ b/libavformat/matroskaenc.c > @@ -1557,7 +1557,9 @@ static int mkv_write_tag_targets(AVFormatContext *s, > uint32_t elementid, > ret = mkv_add_seekhead_entry(mkv->seekhead, MATROSKA_ID_TAGS, > avio_tell(s->pb)); > if (ret < 0) return ret; > > -start_ebml_master_crc32(s->pb, &mkv->tags_bc, mkv, MATROSKA_ID_TAGS); > +ret = start_ebml_master_crc32(s->pb, &mkv->tags_bc, mkv, > MATROSKA_ID_TAGS); > +if (ret < 0) > +return ret; > } > pb = mkv->tags_bc; > > @@ -1653,7 +1655,10 @@ static int mkv_write_tags(AVFormatContext *s) > if (st->codecpar->codec_type == AVMEDIA_TYPE_ATTACHMENT) > continue; > > -mkv_write_tag_targets(s, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, > &tag_target); > +ret = mkv_write_tag_targets(s, MATROSKA_ID_TAGTARGETS_TRACKUID, > +i + 1, &tag_target); > +if (ret < 0) > +return ret; > pb = mkv->tags_bc; > > tag = start_ebml_master(pb, MATROSKA_ID_SIMPLETAG, 0); > Ping. - Andreas ___ 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] [PATCHv2 2/3] libfdk-aacdec: Use the decoder's default level limiter settings
It was disabled by default in 2dbd35b00c6433e587d5f44d5dbc8972ebbaa88e as it added delay, but now we compensate for the delay properly by offsetting timestamps. --- libavcodec/libfdk-aacdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c index d9b080cf3e..b43226f515 100644 --- a/libavcodec/libfdk-aacdec.c +++ b/libavcodec/libfdk-aacdec.c @@ -81,7 +81,8 @@ static const AVOption fdk_aac_dec_options[] = { { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on (RF mode) and [0] is off", OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, NULL}, #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10 -{ "level_limit", "Signal level limiting", OFFSET(level_limit), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 1, AD }, +{ "level_limit", "Signal level limiting", + OFFSET(level_limit),AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, AD }, #endif #if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0 { "drc_effect","Dynamic Range Control: effect type, where e.g. [0] is none and [6] is general", -- 2.21.1 (Apple Git-122.3) ___ 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".
Re: [FFmpeg-devel] [PATCH 3/3] libfdk-aacdec: Allow explicitly disabling the DRC reference level option
On 2/5/2020 8:07 AM, Martin Storsjö wrote: > Previously, it was always left in the automatic mode, if the option > was set to the only special (negative) value. Now there's two separate > special values for this option, -1 for automatic (metadata based) > and -2 for explicitly disabled. > --- > libavcodec/libfdk-aacdec.c | 10 -- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c > index 32a97958c4..cc50fdce2f 100644 > --- a/libavcodec/libfdk-aacdec.c > +++ b/libavcodec/libfdk-aacdec.c > @@ -76,8 +76,8 @@ static const AVOption fdk_aac_dec_options[] = { > OFFSET(drc_boost), AV_OPT_TYPE_INT, { .i64 = -1 > }, -1, 127, AD, NULL}, > { "drc_cut", "Dynamic Range Control: attenuation factor, where [0] is > none and [127] is max compression", > OFFSET(drc_cut),AV_OPT_TYPE_INT, { .i64 = -1 > }, -1, 127, AD, NULL}, > -{ "drc_level", "Dynamic Range Control: reference level, quantized to > 0.25dB steps where [0] is 0dB and [127] is -31.75dB", > - OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = > -1}, -1, 127, AD, NULL}, > +{ "drc_level", "Dynamic Range Control: reference level, quantized to > 0.25dB steps where [0] is 0dB and [127] is -31.75dB, -1 for auto, and -2 for > disabled", Not against adding this extra explanation here since this one is not a simple boolean option, but i see there's no entry for fdk-aacdec in decoders.texy, so could you add one with all the options described in it? Bump micro, and LGTM. > + OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = > -1}, -2, 127, AD, NULL}, > { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is > on (RF mode) and [0] is off", > OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = > -1}, -1, 1, AD, NULL}, > #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10 > @@ -298,6 +298,12 @@ static av_cold int fdk_aac_decode_init(AVCodecContext > *avctx) > } > > if (s->drc_level != -1) { > +// This option defaults to -1, i.e. not calling > +// aacDecoder_SetParam(AAC_DRC_REFERENCE_LEVEL) at all, which > defaults > +// to the level from DRC metadata, if available. The user can set > +// -drc_level -2, which calls aacDecoder_SetParam( > +// AAC_DRC_REFERENCE_LEVEL) with a negative value, which then > +// explicitly disables the feature. > if (aacDecoder_SetParam(s->handle, AAC_DRC_REFERENCE_LEVEL, > s->drc_level) != AAC_DEC_OK) { > av_log(avctx, AV_LOG_ERROR, "Unable to set DRC reference level > in the decoder\n"); > return AVERROR_UNKNOWN; > ___ 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".
Re: [FFmpeg-devel] [PATCH 3/3] libfdk-aacdec: Allow explicitly disabling the DRC reference level option
On Wed, 5 Feb 2020, James Almer wrote: On 2/5/2020 8:07 AM, Martin Storsjö wrote: Previously, it was always left in the automatic mode, if the option was set to the only special (negative) value. Now there's two separate special values for this option, -1 for automatic (metadata based) and -2 for explicitly disabled. --- libavcodec/libfdk-aacdec.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c index 32a97958c4..cc50fdce2f 100644 --- a/libavcodec/libfdk-aacdec.c +++ b/libavcodec/libfdk-aacdec.c @@ -76,8 +76,8 @@ static const AVOption fdk_aac_dec_options[] = { OFFSET(drc_boost), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, NULL}, { "drc_cut", "Dynamic Range Control: attenuation factor, where [0] is none and [127] is max compression", OFFSET(drc_cut),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, NULL}, -{ "drc_level", "Dynamic Range Control: reference level, quantized to 0.25dB steps where [0] is 0dB and [127] is -31.75dB", - OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 127, AD, NULL}, +{ "drc_level", "Dynamic Range Control: reference level, quantized to 0.25dB steps where [0] is 0dB and [127] is -31.75dB, -1 for auto, and -2 for disabled", Not against adding this extra explanation here since this one is not a simple boolean option, but i see there's no entry for fdk-aacdec in decoders.texy, so could you add one with all the options described in it? I'd say that's a separate issue from these patches - I could look into doing that, but that would be a later step. // Martin ___ 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".
Re: [FFmpeg-devel] [PATCH 3/3] libfdk-aacdec: Allow explicitly disabling the DRC reference level option
On 2/5/2020 10:12 AM, Martin Storsjö wrote: > On Wed, 5 Feb 2020, James Almer wrote: > >> On 2/5/2020 8:07 AM, Martin Storsjö wrote: >>> Previously, it was always left in the automatic mode, if the option >>> was set to the only special (negative) value. Now there's two separate >>> special values for this option, -1 for automatic (metadata based) >>> and -2 for explicitly disabled. >>> --- >>> libavcodec/libfdk-aacdec.c | 10 -- >>> 1 file changed, 8 insertions(+), 2 deletions(-) >>> >>> diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c >>> index 32a97958c4..cc50fdce2f 100644 >>> --- a/libavcodec/libfdk-aacdec.c >>> +++ b/libavcodec/libfdk-aacdec.c >>> @@ -76,8 +76,8 @@ static const AVOption fdk_aac_dec_options[] = { >>> OFFSET(drc_boost), AV_OPT_TYPE_INT, { >>> .i64 = -1 }, -1, 127, AD, NULL }, >>> { "drc_cut", "Dynamic Range Control: attenuation factor, where >>> [0] is none and [127] is max compression", >>> OFFSET(drc_cut), AV_OPT_TYPE_INT, { >>> .i64 = -1 }, -1, 127, AD, NULL }, >>> - { "drc_level", "Dynamic Range Control: reference level, >>> quantized to 0.25dB steps where [0] is 0dB and [127] is -31.75dB", >>> - OFFSET(drc_level), AV_OPT_TYPE_INT, { >>> .i64 = -1}, -1, 127, AD, NULL }, >>> + { "drc_level", "Dynamic Range Control: reference level, >>> quantized to 0.25dB steps where [0] is 0dB and [127] is -31.75dB, -1 >>> for auto, and -2 for disabled", >> >> Not against adding this extra explanation here since this one is not a >> simple boolean option, but i see there's no entry for fdk-aacdec in >> decoders.texy, so could you add one with all the options described in it? > > I'd say that's a separate issue from these patches - I could look into > doing that, but that would be a later step. Yes, it's a request, not a blocking comment. > > // Martin > ___ > 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".
Re: [FFmpeg-devel] [PATCH] Update HDR10+ metadata structure.
Hi Mohammad, On Tue, Feb 04, 2020 at 18:44:00 -0800, Mohammad Izadi wrote: > --- a/libavutil/hdr_dynamic_metadata.c > +++ b/libavutil/hdr_dynamic_metadata.c > @@ -1,4 +1,4 @@ > -/** > + /** Please review your git diff and your submitted patches carefully. You need to avoid this accidental change. > +if(!data) ffmpeg style: "if (" > +if(ret < 0) > +return AVERROR_INVALIDDATA; Ditto. > +if (get_bits_left(&gb) < 2) > +return AVERROR_INVALIDDATA; > +s->num_windows = get_bits(&gb, 2); > + > +if (s->num_windows < 1 || s->num_windows > 3) { > +return AVERROR_INVALIDDATA; > +} Above, you skip the brackets for the one-liner return. Here, you use them. That's inconsistent. > --- a/libavutil/hdr_dynamic_metadata.h > +++ b/libavutil/hdr_dynamic_metadata.h > @@ -23,6 +23,8 @@ > > #include "frame.h" > #include "rational.h" > +#include "libavcodec/get_bits.h" > +#include "libavcodec/put_bits.h" As the header doesn't use functions from these, but the implementation does, they should be in libavutil/hdr_dynamic_metadata.c instead. > /** > * The nominal maximum display luminance of the targeted system display, > - * in units of 0.0001 candelas per square metre. The value shall be in > + * in units of 1 candelas per square metre. The value shall be in > * the range of 0 to 1, inclusive. > */ This fix is probably not strictly related to your change? Cheers, Moritz ___ 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".
Re: [FFmpeg-devel] [PATCH] vf_ssim: Fix loading doubles to float registers on i386
LGTM, will you push it or me? On 2/5/20, Martin Storsjö wrote: > This fixes the tests filter-refcmp-ssim-yuv and filter-refcmp-ssim-rgb > on i386 after breaking in fcc0424c933742c8fc852371e985d16b6eb4bfe9. > --- > libavfilter/x86/vf_ssim.asm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavfilter/x86/vf_ssim.asm b/libavfilter/x86/vf_ssim.asm > index 1e682fe452..78809305de 100644 > --- a/libavfilter/x86/vf_ssim.asm > +++ b/libavfilter/x86/vf_ssim.asm > @@ -255,6 +255,6 @@ cglobal ssim_end_line, 3, 3, 7, sum0, sum1, w > addpd m0, m4 > %if ARCH_X86_32 > movsdr0m, m0 > -fld r0mp > +fldqword r0m > %endif > RET > -- > 2.21.1 (Apple Git-122.3) > > ___ > 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".
Re: [FFmpeg-devel] [PATCH] vf_ssim: Fix loading doubles to float registers on i386
On Wed, 5 Feb 2020, Paul B Mahol wrote: LGTM, will you push it or me? I pushed it now - thanks! // Martin ___ 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".
Re: [FFmpeg-devel] [PATCH 06/20] avformat/matroskaenc: Check functions that can fail
On Wed, Jan 01, 2020 at 01:58:23AM +0100, Andreas Rheinhardt wrote: > Sometimes it has not been checked whether opening the dynamic buffer for > writing Tags fails; this might have led to segfaults. > > Signed-off-by: Andreas Rheinhardt > --- > libavformat/matroskaenc.c | 9 +++-- > 1 file changed, 7 insertions(+), 2 deletions(-) will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I know you won't believe me, but the highest form of Human Excellence is to question oneself and others. -- Socrates signature.asc Description: PGP signature ___ 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".
Re: [FFmpeg-devel] [PATCH] Update HDR10+ metadata structure.
Please check my responses inline: On Wed, Feb 5, 2020 at 5:48 AM Moritz Barsnick wrote: > Hi Mohammad, > > On Tue, Feb 04, 2020 at 18:44:00 -0800, Mohammad Izadi wrote: > > --- a/libavutil/hdr_dynamic_metadata.c > > +++ b/libavutil/hdr_dynamic_metadata.c > > @@ -1,4 +1,4 @@ > > -/** > > + /** > > Please review your git diff and your submitted patches carefully. You > need to avoid this accidental change. > reverted the change. > > > +if(!data) > > ffmpeg style: "if (" > Fixed. > > > +if(ret < 0) > > +return AVERROR_INVALIDDATA; > > Ditto. > > Fixed. > > +if (get_bits_left(&gb) < 2) > > +return AVERROR_INVALIDDATA; > > +s->num_windows = get_bits(&gb, 2); > > + > > +if (s->num_windows < 1 || s->num_windows > 3) { > > +return AVERROR_INVALIDDATA; > > +} > > Above, you skip the brackets for the one-liner return. Here, you use > them. That's inconsistent. > > Fixed. > > --- a/libavutil/hdr_dynamic_metadata.h > > +++ b/libavutil/hdr_dynamic_metadata.h > > @@ -23,6 +23,8 @@ > > > > #include "frame.h" > > #include "rational.h" > > +#include "libavcodec/get_bits.h" > > +#include "libavcodec/put_bits.h" > > As the header doesn't use functions from these, but the implementation > does, they should be in libavutil/hdr_dynamic_metadata.c instead. > Right. Changed. > > > /** > > * The nominal maximum display luminance of the targeted system > display, > > - * in units of 0.0001 candelas per square metre. The value shall be > in > > + * in units of 1 candelas per square metre. The value shall be in > > * the range of 0 to 1, inclusive. > > */ > > This fix is probably not strictly related to your change? > Right. I have changed ffmpeg locally to pass through HDR10+ in ffmpeg. I have to split my changes to smaller CLs for review. So, some changes like this may not strictly related, but required for my next changes. Here, the comment explanation needs correction anyway. > > Cheers, > Moritz > ___ > 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] Update HDR10+ metadata structure.
From: Mohammad Izadi Trying to read HDR10+ metadata from HEVC/SEI and pass it to packet side data in the follow-up CLs. --- libavutil/hdr_dynamic_metadata.c | 165 +++ libavutil/hdr_dynamic_metadata.h | 12 ++- libavutil/version.h | 2 +- 3 files changed, 177 insertions(+), 2 deletions(-) diff --git a/libavutil/hdr_dynamic_metadata.c b/libavutil/hdr_dynamic_metadata.c index 0fa1ee82de..a988bcd2d5 100644 --- a/libavutil/hdr_dynamic_metadata.c +++ b/libavutil/hdr_dynamic_metadata.c @@ -19,8 +19,17 @@ */ #include "hdr_dynamic_metadata.h" +#include "libavcodec/get_bits.h" #include "mem.h" +static const int64_t luminance_den = 1; +static const int32_t peak_luminance_den = 15; +static const int64_t rgb_den = 10; +static const int32_t fraction_pixel_den = 1000; +static const int32_t knee_point_den = 4095; +static const int32_t bezier_anchor_den = 1023; +static const int32_t saturation_weight_den = 8; + AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t *size) { AVDynamicHDRPlus *hdr_plus = av_mallocz(sizeof(AVDynamicHDRPlus)); @@ -45,3 +54,159 @@ AVDynamicHDRPlus *av_dynamic_hdr_plus_create_side_data(AVFrame *frame) return (AVDynamicHDRPlus *)side_data->data; } + +int av_dynamic_hdr_plus_decode(const uint8_t *data, size_t size, + AVDynamicHDRPlus *s) +{ +int w, i, j; +GetBitContext gb; +if (!data) +return AVERROR_INVALIDDATA; + +int ret = init_get_bits8(&gb, data, size); +if (ret < 0) +return AVERROR_INVALIDDATA; + +if (get_bits_left(&gb) < 2) +return AVERROR_INVALIDDATA; +s->num_windows = get_bits(&gb, 2); + +if (s->num_windows < 1 || s->num_windows > 3) +return AVERROR_INVALIDDATA; + +if (get_bits_left(&gb) < ((19 * 8 + 1) * (s->num_windows - 1))) +return AVERROR_INVALIDDATA; +for (w = 1; w < s->num_windows; w++) { +s->params[w].window_upper_left_corner_x.num = get_bits(&gb, 16); +s->params[w].window_upper_left_corner_y.num = get_bits(&gb, 16); +s->params[w].window_lower_right_corner_x.num = get_bits(&gb, 16); +s->params[w].window_lower_right_corner_y.num = get_bits(&gb, 16); +// The corners are set to absolute coordinates here. They should be +// converted to the relative coordinates (in [0, 1]) in the decoder. +s->params[w].window_upper_left_corner_x.den = 1; +s->params[w].window_upper_left_corner_y.den = 1; +s->params[w].window_lower_right_corner_x.den = 1; +s->params[w].window_lower_right_corner_y.den = 1; + +s->params[w].center_of_ellipse_x = get_bits(&gb, 16); +s->params[w].center_of_ellipse_y = get_bits(&gb, 16); +s->params[w].rotation_angle = get_bits(&gb, 8); +s->params[w].semimajor_axis_internal_ellipse = get_bits(&gb, 16); +s->params[w].semimajor_axis_external_ellipse = get_bits(&gb, 16); +s->params[w].semiminor_axis_external_ellipse = get_bits(&gb, 16); +s->params[w].overlap_process_option = get_bits1(&gb); +} + +if (get_bits_left(&gb) < 28) +return AVERROR(EINVAL); +s->targeted_system_display_maximum_luminance.num = get_bits(&gb, 27); +s->targeted_system_display_maximum_luminance.den = luminance_den; +s->targeted_system_display_actual_peak_luminance_flag = get_bits1(&gb); + +if (s->targeted_system_display_actual_peak_luminance_flag) { +int rows, cols; +if (get_bits_left(&gb) < 10) +return AVERROR(EINVAL); +rows = get_bits(&gb, 5); +cols = get_bits(&gb, 5); +if (((rows < 2) || (rows > 25)) || ((cols < 2) || (cols > 25))) +return AVERROR_INVALIDDATA; + +s->num_rows_targeted_system_display_actual_peak_luminance = rows; +s->num_cols_targeted_system_display_actual_peak_luminance = cols; + +if (get_bits_left(&gb) < (rows * cols * 4)) +return AVERROR(EINVAL); + +for (i = 0; i < rows; i++) { +for (j = 0; j < cols; j++) { +s->targeted_system_display_actual_peak_luminance[i][j].num = get_bits(&gb, 4); +s->targeted_system_display_actual_peak_luminance[i][j].den = peak_luminance_den; +} +} +} +for (w = 0; w < s->num_windows; w++) { +if (get_bits_left(&gb) < (3 * 17 + 17 + 4)) +return AVERROR(EINVAL); +for (i = 0; i < 3; i++) { +s->params[w].maxscl[i].num = get_bits(&gb, 17); +s->params[w].maxscl[i].den = rgb_den; +} +s->params[w].average_maxrgb.num = get_bits(&gb, 17); +s->params[w].average_maxrgb.den = rgb_den; +s->params[w].num_distribution_maxrgb_percentiles = get_bits(&gb, 4); + +if (get_bits_left(&gb) < +(s->params[w].num_distribution_maxrgb_percentiles * 24)) +return AVERROR(EINVAL); +for (i = 0; i < s->params[w].num_distribution_maxrgb_percentiles; i++) {
Re: [FFmpeg-devel] [PATCH 001/244] Add a new channel layout API
On Tue, 7 Jan 2020, Anton Khirnov wrote: Quoting Nicolas George (2019-12-31 16:17:49) Anton Khirnov (12019-12-29): > I do not agree. Duplicated channels in a layout are expected to be a > fringe thing and how you handle them highly depends on the specific use > case. I expect a typical caller will want to disregard that possibility > and just take the first channel of each semantics. > So I do not believe a dedicated function for this makes sense. We could > always add something later though, if it turns out to be necessary. I think you are making a mistake. I think that as soon as it will be technically possible, we will see cases with duplicated channels. And I know that some filters will do exactly that as soon as they are ported to this new API. Quicktime also allows duplicated channels in a single audio track, this is unfortunately a commonly used feature. So if a new API is introduced to overcome the limitations of the existing one, supporting this should be seriously considered. Regards, Marton ___ 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] checkasm: sbrdsp: Fix a spurious test failure by calculating a better epsilon for sum_square
--- tests/checkasm/sbrdsp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/checkasm/sbrdsp.c b/tests/checkasm/sbrdsp.c index 558f452c9b..516b9f0ec6 100644 --- a/tests/checkasm/sbrdsp.c +++ b/tests/checkasm/sbrdsp.c @@ -17,6 +17,7 @@ */ #include "libavcodec/sbrdsp.h" +#include #include "checkasm.h" @@ -51,13 +52,14 @@ static void test_sum_square(void) INTFLOAT res0; INTFLOAT res1; LOCAL_ALIGNED_16(INTFLOAT, src, [256], [2]); +double t = 4 * 256; declare_func_float(INTFLOAT, INTFLOAT (*x)[2], int n); randomize((INTFLOAT *)src, 256 * 2); res0 = call_ref(src, 256); res1 = call_new(src, 256); -if (!float_near_abs_eps(res0, res1, EPS)) +if (!float_near_abs_eps(res0, res1, t * 2 * FLT_EPSILON)) fail(); bench_new(src, 256); } -- 2.17.1 ___ 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".
Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: allow a custom SDT and PAT period
On Wed, 5 Feb 2020, Steven Liu wrote: Marton Balint 于 2020年2月5日周三 上午5:39写道: The default is not to write SDT and PAT periodically, only in the beginning of every segment. After this patch the user might override this if needed. Signed-off-by: Marton Balint --- libavformat/hlsenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 87b861d437..f6dd894343 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -861,8 +861,8 @@ static int hls_mux_init(AVFormatContext *s, VariantStream *vs) /* We only require one PAT/PMT per segment. */ char period[21]; snprintf(period, sizeof(period), "%d", (INT_MAX / 2) - 1); -av_dict_set(&options, "sdt_period", period, 0); -av_dict_set(&options, "pat_period", period, 0); +av_dict_set(&options, "sdt_period", period, AV_DICT_DONT_OVERWRITE); +av_dict_set(&options, "pat_period", period, AV_DICT_DONT_OVERWRITE); } ret = avformat_init_output(oc, &options); remaining_options = av_dict_count(options); -- 2.16.4 LGTM Thanks, applied. Regards, Marton ___ 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".
Re: [FFmpeg-devel] [PATCH] avfilter/pad: round output width/height up instead of down. Fixes bugs #1618 and #8475.
Hoping someone can review this and apply it if it looks good. > The pad filter is currently broken for cases where all of the following hold: > > (1) chroma subsampling exists (very common), > > (2) an input dimension is odd (uncommon), and > > (3) the corresponding output dimension is either the same as the input, > or an expression like "ow-iw" or "oh-ih" is used to place the image at > the right/bottom edge and the extra padding is even in size. > > The cause of the breakage is essentially that the output width and > height are being rounded downward, causing the image to exceed the > padded area slightly. > > It seems best to me to simply round the output width/height up instead > of down, so I've attached a patch to do that. This fixes bugs #1618 and > #8475. > > Commands to reproduce the bug: > > # create 15x15 test jpeg with 4:2:0 subsampling > ffmpeg -f lavfi -i color=red:15x15,format=rgb24 -vframes 1 -vf > format=yuvj420p red.jpg > > # output size = input size. fails > ffmpeg -i red.jpg -vf pad=iw:ih:0:0 pad1.png > > # input at bottom right of output. fails > ffmpeg -i red.jpg -vf pad=iw+16:ih+16:ow-iw:oh-ih pad2.png > > Ivan > > --- > libavfilter/vf_pad.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c > index e86292e..493e342 100644 > --- a/libavfilter/vf_pad.c > +++ b/libavfilter/vf_pad.c > @@ -178,8 +178,8 @@ static int config_input(AVFilterLink *inlink) > if (s->y < 0 || s->y + inlink->h > s->h) > s->y = var_values[VAR_Y] = (s->h - inlink->h) / 2; > > -s->w= ff_draw_round_to_sub(&s->draw, 0, -1, s->w); > -s->h= ff_draw_round_to_sub(&s->draw, 1, -1, s->h); > +s->w= ff_draw_round_to_sub(&s->draw, 0, +1, s->w); > +s->h= ff_draw_round_to_sub(&s->draw, 1, +1, s->h); > /* sanity check params */ > if (s->w < inlink->w || s->h < inlink->h) { > av_log(ctx, AV_LOG_ERROR, "Padded dimensions cannot be smaller than > input dimensions.\n"); > -- > 2.20.1 ___ 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".
Re: [FFmpeg-devel] [PATCH v5 2/2] avcodec/libvpxenc: add a way to explicitly set temporal layer id
On Mon, Feb 3, 2020 at 5:45 PM Wonkap Jang wrote: > > Hi > > On Mon, Feb 3, 2020 at 12:45 PM James Zern > wrote: > > > On Mon, Feb 3, 2020 at 10:02 AM Wonkap Jang > > wrote: > > > > > > In order for rate control to correctly allocate bitrate to each temporal > > > layer, correct temporal layer id has to be set to each frame. This > > > commit provides the ability to set correct temporal layer id for each > > > frame. > > > --- > > > libavcodec/libvpxenc.c | 13 - > > > 1 file changed, 12 insertions(+), 1 deletion(-) > > > > > > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c > > > index 6fca05e6b1..2093aa8bca 100644 > > > --- a/libavcodec/libvpxenc.c > > > +++ b/libavcodec/libvpxenc.c > > > @@ -1519,11 +1519,22 @@ static int vpx_encode(AVCodecContext *avctx, > > AVPacket *pkt, > > > #endif > > > if (frame->pict_type == AV_PICTURE_TYPE_I) > > > flags |= VPX_EFLAG_FORCE_KF; > > > -if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == > > AV_CODEC_ID_VP8 && frame->metadata) { > > > +if (frame->metadata) { > > > AVDictionaryEntry* en = av_dict_get(frame->metadata, > > "vp8-flags", NULL, 0); > > > > I think you'll want to check the codec being used for this one still. > > ___ > > 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". > > > You want me to check whether it is vp8 or vp9? because... the flags will > work for both, right? > I meant specifically the field called 'vp8-flags', but looking again that looks mostly like it was misnamed. I think there's a mention in doc/encoders.texi about metadata, should that be updated to make explicit reference to this field? > If the flags work for both vp8 and vp9, the codec type doesn't have to be > checked, no? > > Thanks, > > Wonkap > ___ > 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".
Re: [FFmpeg-devel] [PATCH] avcodec/aptx: split decoder and encoder into separate files
On 1/27/2020 3:36 PM, James Almer wrote: > On 12/8/2019 12:11 PM, James Almer wrote: >> Signed-off-by: James Almer >> --- >> Untested beyond checking it compiles because there are no FATE tests for >> either >> module. >> >> libavcodec/Makefile | 8 +- >> libavcodec/aptx.c| 634 +-- >> libavcodec/aptx.h| 221 +++ >> libavcodec/aptxdec.c | 206 ++ >> libavcodec/aptxenc.c | 271 ++ >> 5 files changed, 709 insertions(+), 631 deletions(-) >> create mode 100644 libavcodec/aptx.h >> create mode 100644 libavcodec/aptxdec.c >> create mode 100644 libavcodec/aptxenc.c > > Will push this soon if there are no objections. Pushed. ___ 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 v2 1/2] avcodec: add decoder for Simon & Schuster Interactive's ADPCM variant
Adds support for the ADPCM variant used by some Simon & Schuster Interactive games such as Real War, and Real War: Rogue States. Signed-off-by: Zane van Iperen --- libavcodec/Makefile | 1 + libavcodec/adpcm.c | 10 ++ libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h| 1 + libavcodec/codec_desc.c | 7 +++ libavcodec/version.h| 4 ++-- 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 55899194e2..7825f2741b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -844,6 +844,7 @@ OBJS-$(CONFIG_ADPCM_IMA_OKI_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_QT_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_QT_ENCODER) += adpcmenc.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_RAD_DECODER) += adpcm.o adpcm_data.o +OBJS-$(CONFIG_ADPCM_IMA_SSI_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_SMJPEG_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_WAV_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER) += adpcmenc.o adpcm_data.o diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 9a42353351..0cd28431d7 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -13,6 +13,7 @@ * MAXIS EA ADPCM decoder by Robert Marston (rmars...@gmail.com) * THP ADPCM decoder by Marco Gerards (mgera...@xs4all.nl) * Argonaut Games ADPCM decoder by Zane van Iperen (z...@zanevaniperen.com) + * Simon & Schuster Interactive ADPCM decoder by Zane van Iperen (z...@zanevaniperen.com) * * This file is part of FFmpeg. * @@ -620,6 +621,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb, case AV_CODEC_ID_ADPCM_IMA_WS: case AV_CODEC_ID_ADPCM_YAMAHA: case AV_CODEC_ID_ADPCM_AICA: +case AV_CODEC_ID_ADPCM_IMA_SSI: nb_samples = buf_size * 2 / ch; break; } @@ -1172,6 +1174,13 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); } break; +case AV_CODEC_ID_ADPCM_IMA_SSI: +while (bytestream2_get_bytes_left(&gb) > 0) { +int v = bytestream2_get_byteu(&gb); +*samples++ = adpcm_ima_qt_expand_nibble(&c->status[0], v >> 4 , 3); +*samples++ = adpcm_ima_qt_expand_nibble(&c->status[st], v & 0x0F, 3); +} +break; case AV_CODEC_ID_ADPCM_IMA_OKI: while (bytestream2_get_bytes_left(&gb) > 0) { int v = bytestream2_get_byteu(&gb); @@ -1906,6 +1915,7 @@ ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_ISS, sample_fmts_s16, adpcm_ima_iss, ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_OKI, sample_fmts_s16, adpcm_ima_oki, "ADPCM IMA Dialogic OKI"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_QT, sample_fmts_s16p, adpcm_ima_qt, "ADPCM IMA QuickTime"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_RAD, sample_fmts_s16, adpcm_ima_rad, "ADPCM IMA Radical"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SSI, sample_fmts_s16, adpcm_ima_ssi, "ADPCM IMA Simon & Schuster Interactive"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SMJPEG, sample_fmts_s16, adpcm_ima_smjpeg, "ADPCM IMA Loki SDL MJPEG"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WAV, sample_fmts_s16p, adpcm_ima_wav, "ADPCM IMA WAV"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WS, sample_fmts_both, adpcm_ima_ws, "ADPCM IMA Westwood"); diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 01a083d06b..0ad3338f9a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -609,6 +609,7 @@ extern AVCodec ff_adpcm_ima_oki_decoder; extern AVCodec ff_adpcm_ima_qt_encoder; extern AVCodec ff_adpcm_ima_qt_decoder; extern AVCodec ff_adpcm_ima_rad_decoder; +extern AVCodec ff_adpcm_ima_ssi_decoder; extern AVCodec ff_adpcm_ima_smjpeg_decoder; extern AVCodec ff_adpcm_ima_wav_encoder; extern AVCodec ff_adpcm_ima_wav_decoder; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 0e7ca1db4d..77eb890549 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -546,6 +546,7 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_MTAF, AV_CODEC_ID_ADPCM_AGM, AV_CODEC_ID_ADPCM_ARGO, +AV_CODEC_ID_ADPCM_IMA_SSI, /* AMR */ AV_CODEC_ID_AMR_NB = 0x12000, diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 32f573d58c..621a87cf34 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -2304,6 +2304,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("ADPCM Argonaut Games"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, +{ +.id= AV_CODEC_ID_ADPCM_IMA_SSI, +.type = AVMEDIA_TYPE_AUDIO, +.name = "adpcm_ima_ssi", +.long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Simon & Schuster Interactive"), +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODE
[FFmpeg-devel] [PATCH v2 0/2] Simon & Schuster Interactive VAG demuxer + decoder.
Hi all, This patchset adds support for the VAG container and ADPCM variant used by some Simon & Schuster Interactive games such as 'Real War', and 'Real War: Rogue States'. It has been tested against VAG files from both games. v2: - simplify the demuxer - fix error in header structure Some things to note: * SSI's VAG has no relation to the existing PS2 VAG. I've named it 'kvag' (after its tag), but am open to suggestions if this is inappropriate (ssi_vag?). Zane Zane van Iperen (2): avcodec: add decoder for Simon & Schuster Interactive's ADPCM variant avformat: add demuxer for Simon & Schuster Interactive's VAG format libavcodec/Makefile | 1 + libavcodec/adpcm.c | 10 libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h | 1 + libavcodec/codec_desc.c | 7 +++ libavcodec/version.h | 4 +- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/kvag.c | 117 +++ libavformat/version.h| 2 +- 10 files changed, 142 insertions(+), 3 deletions(-) create mode 100644 libavformat/kvag.c -- 2.17.1 ___ 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 v2 2/2] avformat: add demuxer for Simon & Schuster Interactive's VAG format
Adds support for the custom VAG container used by some Simon & Schuster Interactive games such as Real War, and Real War: Rogue States. Signed-off-by: Zane van Iperen --- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/kvag.c | 117 +++ libavformat/version.h| 2 +- 4 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 libavformat/kvag.c diff --git a/libavformat/Makefile b/libavformat/Makefile index ba6ea8c4a6..710cc4d088 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -279,6 +279,7 @@ OBJS-$(CONFIG_JACOSUB_DEMUXER) += jacosubdec.o subtitles.o OBJS-$(CONFIG_JACOSUB_MUXER) += jacosubenc.o rawenc.o OBJS-$(CONFIG_JV_DEMUXER)+= jvdec.o OBJS-$(CONFIG_KUX_DEMUXER) += flvdec.o +OBJS-$(CONFIG_KVAG_DEMUXER) += kvag.o OBJS-$(CONFIG_LATM_MUXER)+= latmenc.o rawenc.o OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o OBJS-$(CONFIG_LOAS_DEMUXER) += loasdec.o rawdec.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index fe74a32e47..3ea4100e85 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -214,6 +214,7 @@ extern AVInputFormat ff_jacosub_demuxer; extern AVOutputFormat ff_jacosub_muxer; extern AVInputFormat ff_jv_demuxer; extern AVInputFormat ff_kux_demuxer; +extern AVInputFormat ff_kvag_demuxer; extern AVOutputFormat ff_latm_muxer; extern AVInputFormat ff_lmlm4_demuxer; extern AVInputFormat ff_loas_demuxer; diff --git a/libavformat/kvag.c b/libavformat/kvag.c new file mode 100644 index 00..71b0eb4118 --- /dev/null +++ b/libavformat/kvag.c @@ -0,0 +1,117 @@ +/* + * Simon & Schuster Interactive VAG demuxer + * + * Copyright (C) 2020 Zane van Iperen (z...@zanevaniperen.com) + * + * 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 "avformat.h" +#include "internal.h" +#include "libavutil/intreadwrite.h" + +#define KVAG_TAGMKTAG('K', 'V', 'A', 'G') +#define KVAG_HEADER_SIZE14 +#define KVAG_MAX_READ_SIZE 4096 + +typedef struct KVAGHeader { +uint32_tmagic; +uint32_tdata_size; +uint32_tsample_rate; +uint16_tstereo; +} KVAGHeader; + +static int kvag_probe(const AVProbeData *p) +{ +if (AV_RL32(p->buf) != KVAG_TAG) +return 0; + +return AVPROBE_SCORE_EXTENSION + 1; +} + +static int kvag_read_header(AVFormatContext *s) +{ +int ret; +AVStream *st; +KVAGHeader hdr; +AVCodecParameters *par; +uint8_t buf[KVAG_HEADER_SIZE]; + +if (!(st = avformat_new_stream(s, NULL))) +return AVERROR(ENOMEM); + +if ((ret = avio_read(s->pb, buf, KVAG_HEADER_SIZE)) < 0) +return ret; +else if (ret != KVAG_HEADER_SIZE) +return AVERROR(EIO); + +hdr.magic = AV_RL32(buf + 0); +hdr.data_size = AV_RL32(buf + 4); +hdr.sample_rate = AV_RL32(buf + 8); +hdr.stereo = AV_RL16(buf + 12); + +par = st->codecpar; +par->codec_type = AVMEDIA_TYPE_AUDIO; +par->codec_id = AV_CODEC_ID_ADPCM_IMA_SSI; +par->format = AV_SAMPLE_FMT_S16; + +if (hdr.stereo) { +par->channel_layout = AV_CH_LAYOUT_STEREO; +par->channels = 2; +} else { +par->channel_layout = AV_CH_LAYOUT_MONO; +par->channels = 1; +} + +par->sample_rate= hdr.sample_rate; +par->bits_per_coded_sample = 4; +par->bits_per_raw_sample= 16; +par->block_align= 1; +par->bit_rate = par->channels * + par->sample_rate * + par->bits_per_coded_sample; + +avpriv_set_pts_info(st, 64, 1, par->sample_rate); +st->start_time = 0; +st->duration= hdr.data_size * + (8 / par->bits_per_coded_sample) / + par->channels; + +return 0; +} + +static int kvag_read_packet(AVFormatContext *s, AVPacket *pkt) +{ +int ret; +AVCodecParameters *par = s->streams[0]->codecpar; + +
Re: [FFmpeg-devel] [EXTREMELY IMPORTANT] [PLEASE DO NOT IGNORE] [PATCH] avfilter/framesync: do not pick AV_TIME_BASE for time base when not needed.
Paul B Mahol (12020-02-05): > I will write patch that fixes this. As unnecessary changing time-base > is wrong way around. I do not want several code paths, requiring extra testing in case of change, unless it is necessary. There is no mystique about the time base: the current code finds one that works, it is enough. -- Nicolas George ___ 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".