ffmpeg-cvslog
Threads by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
February 2024
- 1 participants
- 389 discussions
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Sun Feb 25 22:12:33 2024 +0100| [80eca6ec994bf29c9f0d0c11b0f39072e35c542f] | committer: Andreas Rheinhardt
avcodec/aacps: Inline ff_ps_ctx_init()
Reviewed-by: Lynne <dev(a)lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80eca6ec994bf29c9…
---
libavcodec/aacps.c | 5 -----
libavcodec/aacps.h | 7 ++++++-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c
index 5a3e6b3dfd..6008edd332 100644
--- a/libavcodec/aacps.c
+++ b/libavcodec/aacps.c
@@ -740,8 +740,3 @@ int AAC_RENAME(ff_ps_apply)(PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][
av_cold void AAC_RENAME(ff_ps_init)(void) {
ps_tableinit();
}
-
-av_cold void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps)
-{
- AAC_RENAME(ff_psdsp_init)(&ps->dsp);
-}
diff --git a/libavcodec/aacps.h b/libavcodec/aacps.h
index c8814b4c3d..08c92dc404 100644
--- a/libavcodec/aacps.h
+++ b/libavcodec/aacps.h
@@ -93,7 +93,12 @@ extern const int8_t ff_k_to_i_34[];
void ff_ps_init_common(void);
void AAC_RENAME(ff_ps_init)(void);
-void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps);
+
+static inline void AAC_RENAME(ff_ps_ctx_init)(PSContext *ps)
+{
+ AAC_RENAME(ff_psdsp_init)(&ps->dsp);
+}
+
int ff_ps_read_data(void *logctx, GetBitContext *gb,
PSCommonContext *ps, int bits_left);
int AAC_RENAME(ff_ps_apply)(PSContext *ps, INTFLOAT L[2][38][64], INTFLOAT R[2][38][64], int top);
1
0
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Sun Feb 25 22:09:12 2024 +0100| [1ecc9065364d399bca8e27028dba064e5acc69c4] | committer: Andreas Rheinhardt
avcodec/aacdec: Rename AACContext to AACDecContext
It is decoder-only; furthermore, there is already
an AACContext in use by libfdk-aacenc.
Also make aacdec.h provide the typedef for AACContext;
up until now, this has been done by sbr.h.
Reviewed-by: Lynne <dev(a)lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ecc9065364d399bc…
---
libavcodec/aacdec.c | 10 ++--
libavcodec/aacdec.h | 15 +++---
libavcodec/aacdec_fixed.c | 6 +--
libavcodec/aacdec_template.c | 105 ++++++++++++++++++++++--------------------
libavcodec/aacsbr.h | 6 +--
libavcodec/aacsbr_template.c | 34 +++++++-------
libavcodec/mips/aacdec_mips.c | 8 ++--
libavcodec/mips/aacsbr_mips.c | 2 +-
libavcodec/sbr.h | 4 +-
9 files changed, 96 insertions(+), 94 deletions(-)
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 962b1705c6..b1bce7542b 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -210,7 +210,7 @@ static av_always_inline void predict(PredictorState *ps, float *coef,
*
* @param index index into coupling gain array
*/
-static void apply_dependent_coupling(AACContext *ac,
+static void apply_dependent_coupling(AACDecContext *ac,
SingleChannelElement *target,
ChannelElement *cce, int index)
{
@@ -246,7 +246,7 @@ static void apply_dependent_coupling(AACContext *ac,
*
* @param index index into coupling gain array
*/
-static void apply_independent_coupling(AACContext *ac,
+static void apply_independent_coupling(AACDecContext *ac,
SingleChannelElement *target,
ChannelElement *cce, int index)
{
@@ -263,7 +263,7 @@ static void apply_independent_coupling(AACContext *ac,
#define LOAS_SYNC_WORD 0x2b7 ///< 11 bits LOAS sync word
struct LATMContext {
- AACContext aac_ctx; ///< containing AACContext
+ AACDecContext aac_ctx; ///< containing AACContext
int initialized; ///< initialized after a valid extradata was seen
// parser data
@@ -282,7 +282,7 @@ static inline uint32_t latm_get_value(GetBitContext *b)
static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
GetBitContext *gb, int asclen)
{
- AACContext *ac = &latmctx->aac_ctx;
+ AACDecContext *ac = &latmctx->aac_ctx;
AVCodecContext *avctx = ac->avctx;
MPEG4AudioConfig m4ac = { 0 };
GetBitContext gbc;
@@ -556,7 +556,7 @@ const FFCodec ff_aac_decoder = {
CODEC_LONG_NAME("AAC (Advanced Audio Coding)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AAC,
- .priv_data_size = sizeof(AACContext),
+ .priv_data_size = sizeof(AACDecContext),
.init = aac_decode_init,
.close = aac_decode_close,
FF_CODEC_DECODE_CB(aac_decode_frame),
diff --git a/libavcodec/aacdec.h b/libavcodec/aacdec.h
index c4ac63e2fb..37a318659e 100644
--- a/libavcodec/aacdec.h
+++ b/libavcodec/aacdec.h
@@ -81,7 +81,7 @@ typedef struct DynamicRangeControl {
/**
* main AAC decoding context
*/
-struct AACContext {
+typedef struct AACDecContext {
const struct AVClass *class;
struct AVCodecContext *avctx;
struct AVFrame *frame;
@@ -162,18 +162,17 @@ struct AACContext {
int warned_he_aac_mono;
/* aacdec functions pointers */
- void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce);
- void (*apply_ltp)(AACContext *ac, SingleChannelElement *sce);
+ void (*imdct_and_windowing)(struct AACDecContext *ac, SingleChannelElement *sce);
+ void (*apply_ltp)(struct AACDecContext *ac, SingleChannelElement *sce);
void (*apply_tns)(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
IndividualChannelStream *ics, int decode);
- void (*windowing_and_mdct_ltp)(AACContext *ac, INTFLOAT *out,
+ void (*windowing_and_mdct_ltp)(struct AACDecContext *ac, INTFLOAT *out,
INTFLOAT *in, IndividualChannelStream *ics);
- void (*update_ltp)(AACContext *ac, SingleChannelElement *sce);
+ void (*update_ltp)(struct AACDecContext *ac, SingleChannelElement *sce);
void (*vector_pow43)(int *coefs, int len);
void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context);
+} AACDecContext;
-};
-
-void ff_aacdec_init_mips(AACContext *c);
+void ff_aacdec_init_mips(AACDecContext *c);
#endif /* AVCODEC_AACDEC_H */
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index 19662cb7e6..57d3fc8bab 100644
--- a/libavcodec/aacdec_fixed.c
+++ b/libavcodec/aacdec_fixed.c
@@ -355,7 +355,7 @@ static const int cce_scale_fixed[8] = {
*
* @param index index into coupling gain array
*/
-static void apply_dependent_coupling_fixed(AACContext *ac,
+static void apply_dependent_coupling_fixed(AACDecContext *ac,
SingleChannelElement *target,
ChannelElement *cce, int index)
{
@@ -419,7 +419,7 @@ static void apply_dependent_coupling_fixed(AACContext *ac,
*
* @param index index into coupling gain array
*/
-static void apply_independent_coupling_fixed(AACContext *ac,
+static void apply_independent_coupling_fixed(AACDecContext *ac,
SingleChannelElement *target,
ChannelElement *cce, int index)
{
@@ -457,7 +457,7 @@ const FFCodec ff_aac_fixed_decoder = {
CODEC_LONG_NAME("AAC (Advanced Audio Coding)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AAC,
- .priv_data_size = sizeof(AACContext),
+ .priv_data_size = sizeof(AACDecContext),
.init = aac_decode_init,
.close = aac_decode_close,
FF_CODEC_DECODE_CB(aac_decode_frame),
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index cfaa25873f..72c6e206a6 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -94,7 +94,7 @@
#include "decode.h"
#include "internal.h"
-static int output_configure(AACContext *ac,
+static int output_configure(AACDecContext *ac,
uint8_t layout_map[MAX_ELEM_ID*4][3], int tags,
enum OCStatus oc_type, int get_new_frame);
@@ -124,7 +124,7 @@ static int count_channels(uint8_t (*layout)[3], int tags)
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static av_cold int che_configure(AACContext *ac,
+static av_cold int che_configure(AACDecContext *ac,
enum ChannelPosition che_pos,
int type, int id, int *channels)
{
@@ -160,7 +160,7 @@ static av_cold int che_configure(AACContext *ac,
static int frame_configure_elements(AVCodecContext *avctx)
{
- AACContext *ac = avctx->priv_data;
+ AACDecContext *ac = avctx->priv_data;
int type, id, ch, ret;
/* set channel pointers to internal buffers by default */
@@ -411,7 +411,8 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
/**
* Save current output configuration if and only if it has been locked.
*/
-static int push_output_configuration(AACContext *ac) {
+static int push_output_configuration(AACDecContext *ac)
+{
int pushed = 0;
if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
@@ -426,7 +427,8 @@ static int push_output_configuration(AACContext *ac) {
* Restore the previous output configuration if and only if the current
* configuration is unlocked.
*/
-static void pop_output_configuration(AACContext *ac) {
+static void pop_output_configuration(AACDecContext *ac)
+{
if (ac->oc[1].status != OC_LOCKED && ac->oc[0].status != OC_NONE) {
ac->oc[1] = ac->oc[0];
ac->avctx->ch_layout = ac->oc[1].ch_layout;
@@ -441,7 +443,7 @@ static void pop_output_configuration(AACContext *ac) {
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int output_configure(AACContext *ac,
+static int output_configure(AACDecContext *ac,
uint8_t layout_map[MAX_ELEM_ID * 4][3], int tags,
enum OCStatus oc_type, int get_new_frame)
{
@@ -516,7 +518,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
static void flush(AVCodecContext *avctx)
{
- AACContext *ac= avctx->priv_data;
+ AACDecContext *ac= avctx->priv_data;
int type, i, j;
for (type = 3; type >= 0; type--) {
@@ -537,7 +539,7 @@ static void flush(AVCodecContext *avctx)
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
+static int set_default_channel_config(AACDecContext *ac, AVCodecContext *avctx,
uint8_t (*layout_map)[3],
int *tags,
int channel_config)
@@ -577,7 +579,7 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
return 0;
}
-static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
+static ChannelElement *get_che(AACDecContext *ac, int type, int elem_id)
{
/* For PCE based channel configurations map the channels solely based
* on tags. */
@@ -830,12 +832,12 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
/**
* Decode GA "General Audio" specific configuration; reference: table 4.1.
*
- * @param ac pointer to AACContext, may be null
+ * @param ac pointer to AACDecContext, may be null
* @param avctx pointer to AVCCodecContext, used for logging
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
+static int decode_ga_specific_config(AACDecContext *ac, AVCodecContext *avctx,
GetBitContext *gb,
int get_bit_alignment,
MPEG4AudioConfig *m4ac,
@@ -916,7 +918,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
return 0;
}
-static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
+static int decode_eld_specific_config(AACDecContext *ac, AVCodecContext *avctx,
GetBitContext *gb,
MPEG4AudioConfig *m4ac,
int channel_config)
@@ -976,7 +978,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
/**
* Decode audio specific configuration; reference: table 1.13.
*
- * @param ac pointer to AACContext, may be null
+ * @param ac pointer to AACDecContext, may be null
* @param avctx pointer to AVCCodecContext, used for logging
* @param m4ac pointer to MPEG4AudioConfig, used for parsing
* @param gb buffer holding an audio specific config
@@ -985,7 +987,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
*
* @return Returns error status or number of consumed bits. <0 - error
*/
-static int decode_audio_specific_config_gb(AACContext *ac,
+static int decode_audio_specific_config_gb(AACDecContext *ac,
AVCodecContext *avctx,
MPEG4AudioConfig *m4ac,
GetBitContext *gb,
@@ -1052,7 +1054,7 @@ static int decode_audio_specific_config_gb(AACContext *ac,
return get_bits_count(gb);
}
-static int decode_audio_specific_config(AACContext *ac,
+static int decode_audio_specific_config(AACDecContext *ac,
AVCodecContext *avctx,
MPEG4AudioConfig *m4ac,
const uint8_t *data, int64_t bit_size,
@@ -1121,7 +1123,7 @@ static void reset_predictor_group(PredictorState *ps, int group_num)
reset_predict_state(&ps[i]);
}
-static void aacdec_init(AACContext *ac);
+static void aacdec_init(AACDecContext *ac);
static av_cold void aac_static_table_init(void)
{
@@ -1152,7 +1154,7 @@ static AVOnce aac_table_init = AV_ONCE_INIT;
static av_cold int aac_decode_init(AVCodecContext *avctx)
{
float scale;
- AACContext *ac = avctx->priv_data;
+ AACDecContext *ac = avctx->priv_data;
int ret;
if (avctx->sample_rate > 96000)
@@ -1250,7 +1252,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
/**
* Skip data_stream_element; reference: table 4.10.
*/
-static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
+static int skip_data_stream_element(AACDecContext *ac, GetBitContext *gb)
{
int byte_align = get_bits1(gb);
int count = get_bits(gb, 8);
@@ -1267,7 +1269,7 @@ static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
return 0;
}
-static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
+static int decode_prediction(AACDecContext *ac, IndividualChannelStream *ics,
GetBitContext *gb)
{
int sfb;
@@ -1303,7 +1305,7 @@ static void decode_ltp(LongTermPrediction *ltp,
/**
* Decode Individual Channel Stream info; reference: table 4.6.
*/
-static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
+static int decode_ics_info(AACDecContext *ac, IndividualChannelStream *ics,
GetBitContext *gb)
{
const MPEG4AudioConfig *const m4ac = &ac->oc[1].m4ac;
@@ -1429,7 +1431,7 @@ fail:
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int decode_band_types(AACContext *ac, enum BandType band_type[120],
+static int decode_band_types(AACDecContext *ac, enum BandType band_type[120],
int band_type_run_end[120], GetBitContext *gb,
IndividualChannelStream *ics)
{
@@ -1478,7 +1480,7 @@ static int decode_band_types(AACContext *ac, enum BandType band_type[120],
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *gb,
+static int decode_scalefactors(AACDecContext *ac, INTFLOAT sf[120], GetBitContext *gb,
unsigned int global_gain,
IndividualChannelStream *ics,
enum BandType band_type[120],
@@ -1580,7 +1582,7 @@ static int decode_pulses(Pulse *pulse, GetBitContext *gb,
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns,
+static int decode_tns(AACDecContext *ac, TemporalNoiseShaping *tns,
GetBitContext *gb, const IndividualChannelStream *ics)
{
int w, filt, i, coef_len, coef_res, coef_compress;
@@ -1648,7 +1650,7 @@ static void decode_mid_side_stereo(ChannelElement *cpe, GetBitContext *gb,
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
+static int decode_spectrum_and_dequant(AACDecContext *ac, INTFLOAT coef[1024],
GetBitContext *gb, const INTFLOAT sf[120],
int pulse_present, const Pulse *pulse,
const IndividualChannelStream *ics,
@@ -1943,7 +1945,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
/**
* Apply AAC-Main style frequency domain prediction.
*/
-static void apply_prediction(AACContext *ac, SingleChannelElement *sce)
+static void apply_prediction(AACDecContext *ac, SingleChannelElement *sce)
{
int sfb, k;
@@ -2006,7 +2008,7 @@ static void decode_gain_control(SingleChannelElement * sce, GetBitContext * gb)
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int decode_ics(AACContext *ac, SingleChannelElement *sce,
+static int decode_ics(AACDecContext *ac, SingleChannelElement *sce,
GetBitContext *gb, int common_window, int scale_flag)
{
Pulse pulse;
@@ -2097,7 +2099,7 @@ fail:
/**
* Mid/Side stereo decoding; reference: 4.6.8.1.3.
*/
-static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
+static void apply_mid_side_stereo(AACDecContext *ac, ChannelElement *cpe)
{
const IndividualChannelStream *ics = &cpe->ch[0].ics;
INTFLOAT *ch0 = cpe->ch[0].coeffs;
@@ -2135,7 +2137,7 @@ static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
* [1] mask is decoded from bitstream; [2] mask is all 1s;
* [3] reserved for scalable AAC
*/
-static void apply_intensity_stereo(AACContext *ac,
+static void apply_intensity_stereo(AACDecContext *ac,
ChannelElement *cpe, int ms_present)
{
const IndividualChannelStream *ics = &cpe->ch[1].ics;
@@ -2185,7 +2187,7 @@ static void apply_intensity_stereo(AACContext *ac,
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
+static int decode_cpe(AACDecContext *ac, GetBitContext *gb, ChannelElement *cpe)
{
int i, ret, common_window, ms_present = 0;
int eld_syntax = ac->oc[1].m4ac.object_type == AOT_ER_AAC_ELD;
@@ -2238,7 +2240,7 @@ static const float cce_scale[] = {
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
+static int decode_cce(AACDecContext *ac, GetBitContext *gb, ChannelElement *che)
{
int num_gain = 0;
int c, g, sfb, ret;
@@ -2388,7 +2390,7 @@ static int decode_dynamic_range(DynamicRangeControl *che_drc,
return n;
}
-static int decode_fill(AACContext *ac, GetBitContext *gb, int len) {
+static int decode_fill(AACDecContext *ac, GetBitContext *gb, int len) {
uint8_t buf[256];
int i, major, minor;
@@ -2421,7 +2423,7 @@ unknown:
*
* @return Returns number of bytes consumed
*/
-static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
+static int decode_extension_payload(AACDecContext *ac, GetBitContext *gb, int cnt,
ChannelElement *che, enum RawDataBlockType elem_type)
{
int crc_flag = 0;
@@ -2551,7 +2553,7 @@ static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
* Apply windowing and MDCT to obtain the spectral
* coefficient from the predicted sample by LTP.
*/
-static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out,
+static void windowing_and_mdct_ltp(AACDecContext *ac, INTFLOAT *out,
INTFLOAT *in, IndividualChannelStream *ics)
{
const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
@@ -2577,7 +2579,7 @@ static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out,
/**
* Apply the long term prediction
*/
-static void apply_ltp(AACContext *ac, SingleChannelElement *sce)
+static void apply_ltp(AACDecContext *ac, SingleChannelElement *sce)
{
const LongTermPrediction *ltp = &sce->ics.ltp;
const uint16_t *offsets = sce->ics.swb_offset;
@@ -2609,7 +2611,7 @@ static void apply_ltp(AACContext *ac, SingleChannelElement *sce)
/**
* Update the LTP buffer for next frame
*/
-static void update_ltp(AACContext *ac, SingleChannelElement *sce)
+static void update_ltp(AACDecContext *ac, SingleChannelElement *sce)
{
IndividualChannelStream *ics = &sce->ics;
INTFLOAT *saved = sce->saved;
@@ -2647,7 +2649,7 @@ static void update_ltp(AACContext *ac, SingleChannelElement *sce)
/**
* Conduct IMDCT and windowing.
*/
-static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
+static void imdct_and_windowing(AACDecContext *ac, SingleChannelElement *sce)
{
IndividualChannelStream *ics = &sce->ics;
INTFLOAT *in = sce->coeffs;
@@ -2711,7 +2713,7 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
/**
* Conduct IMDCT and windowing.
*/
-static void imdct_and_windowing_960(AACContext *ac, SingleChannelElement *sce)
+static void imdct_and_windowing_960(AACDecContext *ac, SingleChannelElement *sce)
{
IndividualChannelStream *ics = &sce->ics;
INTFLOAT *in = sce->coeffs;
@@ -2772,7 +2774,7 @@ static void imdct_and_windowing_960(AACContext *ac, SingleChannelElement *sce)
memcpy( saved, buf + 480, 480 * sizeof(*saved));
}
}
-static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
+static void imdct_and_windowing_ld(AACDecContext *ac, SingleChannelElement *sce)
{
IndividualChannelStream *ics = &sce->ics;
INTFLOAT *in = sce->coeffs;
@@ -2797,7 +2799,7 @@ static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
memcpy(saved, buf + 256, 256 * sizeof(*saved));
}
-static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
+static void imdct_and_windowing_eld(AACDecContext *ac, SingleChannelElement *sce)
{
UINTFLOAT *in = sce->coeffs;
INTFLOAT *out = sce->ret;
@@ -2865,10 +2867,10 @@ static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
*
* @param apply_coupling_method pointer to (in)dependent coupling function
*/
-static void apply_channel_coupling(AACContext *ac, ChannelElement *cc,
+static void apply_channel_coupling(AACDecContext *ac, ChannelElement *cc,
enum RawDataBlockType type, int elem_id,
enum CouplingPoint coupling_point,
- void (*apply_coupling_method)(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index))
+ void (*apply_coupling_method)(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index))
{
int i, c;
@@ -2898,10 +2900,10 @@ static void apply_channel_coupling(AACContext *ac, ChannelElement *cc,
/**
* Convert spectral data to samples, applying all supported tools as appropriate.
*/
-static void spectral_to_sample(AACContext *ac, int samples)
+static void spectral_to_sample(AACDecContext *ac, int samples)
{
int i, type;
- void (*imdct_and_window)(AACContext *ac, SingleChannelElement *sce);
+ void (*imdct_and_window)(AACDecContext *ac, SingleChannelElement *sce);
switch (ac->oc[1].m4ac.object_type) {
case AOT_ER_AAC_LD:
imdct_and_window = imdct_and_windowing_ld;
@@ -2970,7 +2972,7 @@ static void spectral_to_sample(AACContext *ac, int samples)
}
}
-static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
+static int parse_adts_frame_header(AACDecContext *ac, GetBitContext *gb)
{
int size;
AACADTSHeaderInfo hdr_info;
@@ -3035,7 +3037,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
static int aac_decode_er_frame(AVCodecContext *avctx, AVFrame *frame,
int *got_frame_ptr, GetBitContext *gb)
{
- AACContext *ac = avctx->priv_data;
+ AACDecContext *ac = avctx->priv_data;
const MPEG4AudioConfig *const m4ac = &ac->oc[1].m4ac;
ChannelElement *che;
int err, i;
@@ -3108,7 +3110,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame,
int *got_frame_ptr, GetBitContext *gb,
const AVPacket *avpkt)
{
- AACContext *ac = avctx->priv_data;
+ AACDecContext *ac = avctx->priv_data;
ChannelElement *che = NULL, *che_prev = NULL;
enum RawDataBlockType elem_type, che_prev_type = TYPE_END;
int err, elem_id;
@@ -3317,7 +3319,7 @@ fail:
static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
int *got_frame_ptr, AVPacket *avpkt)
{
- AACContext *ac = avctx->priv_data;
+ AACDecContext *ac = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
GetBitContext gb;
@@ -3379,7 +3381,7 @@ static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
static av_cold int aac_decode_close(AVCodecContext *avctx)
{
- AACContext *ac = avctx->priv_data;
+ AACDecContext *ac = avctx->priv_data;
int i, type;
for (i = 0; i < MAX_ELEM_ID; i++) {
@@ -3402,7 +3404,7 @@ static av_cold int aac_decode_close(AVCodecContext *avctx)
return 0;
}
-static void aacdec_init(AACContext *c)
+static void aacdec_init(AACDecContext *c)
{
c->imdct_and_windowing = imdct_and_windowing;
c->apply_ltp = apply_ltp;
@@ -3424,9 +3426,10 @@ static void aacdec_init(AACContext *c)
* AVOptions for Japanese DTV specific extensions (ADTS only)
*/
#define AACDEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
+#define OFF(field) offsetof(AACDecContext, field)
static const AVOption options[] = {
{"dual_mono_mode", "Select the channel to decode for dual mono",
- offsetof(AACContext, force_dmono_mode), AV_OPT_TYPE_INT, {.i64=-1}, -1, 2,
+ OFF(force_dmono_mode), AV_OPT_TYPE_INT, {.i64=-1}, -1, 2,
AACDEC_FLAGS, .unit = "dual_mono_mode"},
{"auto", "autoselection", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, AACDEC_FLAGS, .unit = "dual_mono_mode"},
@@ -3435,7 +3438,7 @@ static const AVOption options[] = {
{"both", "Select both channels", 0, AV_OPT_TYPE_CONST, {.i64= 0}, INT_MIN, INT_MAX, AACDEC_FLAGS, .unit = "dual_mono_mode"},
{ "channel_order", "Order in which the channels are to be exported",
- offsetof(AACContext, output_channel_order), AV_OPT_TYPE_INT,
+ OFF(output_channel_order), AV_OPT_TYPE_INT,
{ .i64 = CHANNEL_ORDER_DEFAULT }, 0, 1, AACDEC_FLAGS, .unit = "channel_order" },
{ "default", "normal libavcodec channel order", 0, AV_OPT_TYPE_CONST,
{ .i64 = CHANNEL_ORDER_DEFAULT }, .flags = AACDEC_FLAGS, .unit = "channel_order" },
diff --git a/libavcodec/aacsbr.h b/libavcodec/aacsbr.h
index 3a19fe1c7e..ad4935d734 100644
--- a/libavcodec/aacsbr.h
+++ b/libavcodec/aacsbr.h
@@ -69,14 +69,14 @@ enum {
/** Initialize SBR. */
void AAC_RENAME(ff_aac_sbr_init)(void);
/** Initialize one SBR context. */
-int AAC_RENAME(ff_aac_sbr_ctx_init)(AACContext *ac, SpectralBandReplication *sbr, int id_aac);
+int AAC_RENAME(ff_aac_sbr_ctx_init)(struct AACDecContext *ac, SpectralBandReplication *sbr, int id_aac);
/** Close one SBR context. */
void AAC_RENAME(ff_aac_sbr_ctx_close)(SpectralBandReplication *sbr);
/** Decode one SBR element. */
-int AAC_RENAME(ff_decode_sbr_extension)(AACContext *ac, SpectralBandReplication *sbr,
+int AAC_RENAME(ff_decode_sbr_extension)(struct AACDecContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb, int crc, int cnt, int id_aac);
/** Apply one SBR element to one AAC element. */
-void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
+void AAC_RENAME(ff_sbr_apply)(struct AACDecContext *ac, SpectralBandReplication *sbr, int id_aac,
INTFLOAT* L, INTFLOAT *R);
void ff_aacsbr_func_ptr_init_mips(AACSBRContext *c);
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index e0725b6363..ce3834e2dc 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -64,7 +64,7 @@ static void sbr_turnoff(SpectralBandReplication *sbr) {
memset(&sbr->spectrum_params, -1, sizeof(SpectrumParameters));
}
-av_cold int AAC_RENAME(ff_aac_sbr_ctx_init)(AACContext *ac, SpectralBandReplication *sbr, int id_aac)
+av_cold int AAC_RENAME(ff_aac_sbr_ctx_init)(AACDecContext *ac, SpectralBandReplication *sbr, int id_aac)
{
int ret;
float scale;
@@ -254,7 +254,7 @@ static int check_n_master(AVCodecContext *avctx, int n_master, int bs_xover_band
}
/// Master Frequency Band Table (14496-3 sp04 p194)
-static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_make_f_master(AACDecContext *ac, SpectralBandReplication *sbr,
SpectrumParameters *spectrum)
{
unsigned int temp, max_qmf_subbands = 0;
@@ -474,7 +474,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
}
/// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
-static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
+static int sbr_hf_calc_npatches(AACDecContext *ac, SpectralBandReplication *sbr)
{
int i, k, last_k = -1, last_msb = -1, sb = 0;
int msb = sbr->k[0];
@@ -532,7 +532,7 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
}
/// Derived Frequency Band Tables (14496-3 sp04 p197)
-static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr)
+static int sbr_make_f_derived(AACDecContext *ac, SpectralBandReplication *sbr)
{
int k, temp;
#if USE_FIXED
@@ -617,7 +617,7 @@ static const int8_t ceil_log2[] = {
0, 1, 2, 2, 3, 3,
};
-static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
+static int read_sbr_grid(AACDecContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb, SBRData *ch_data)
{
int i;
@@ -800,7 +800,7 @@ static void read_sbr_invf(SpectralBandReplication *sbr, GetBitContext *gb,
ch_data->bs_invf_mode[0][i] = get_bits(gb, 2);
}
-static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
+static int read_sbr_envelope(AACDecContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
SBRData *ch_data, int ch)
{
int bits;
@@ -880,7 +880,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
return 0;
}
-static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
+static int read_sbr_noise(AACDecContext *ac, SpectralBandReplication *sbr, GetBitContext *gb,
SBRData *ch_data, int ch)
{
int i, j;
@@ -922,7 +922,7 @@ static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitCo
return 0;
}
-static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
+static void read_sbr_extension(AACDecContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb,
int bs_extension_id, int *num_bits_left)
{
@@ -949,7 +949,7 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
}
}
-static int read_sbr_single_channel_element(AACContext *ac,
+static int read_sbr_single_channel_element(AACDecContext *ac,
SpectralBandReplication *sbr,
GetBitContext *gb)
{
@@ -973,7 +973,7 @@ static int read_sbr_single_channel_element(AACContext *ac,
return 0;
}
-static int read_sbr_channel_pair_element(AACContext *ac,
+static int read_sbr_channel_pair_element(AACDecContext *ac,
SpectralBandReplication *sbr,
GetBitContext *gb)
{
@@ -1025,7 +1025,7 @@ static int read_sbr_channel_pair_element(AACContext *ac,
return 0;
}
-static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
+static unsigned int read_sbr_data(AACDecContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb, int id_aac)
{
unsigned int cnt = get_bits_count(gb);
@@ -1069,7 +1069,7 @@ static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
return get_bits_count(gb) - cnt;
}
-static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
+static void sbr_reset(AACDecContext *ac, SpectralBandReplication *sbr)
{
int err;
err = sbr_make_f_master(ac, sbr, &sbr->spectrum_params);
@@ -1090,7 +1090,7 @@ static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
*
* @return Returns number of bytes consumed from the TYPE_FIL element.
*/
-int AAC_RENAME(ff_decode_sbr_extension)(AACContext *ac, SpectralBandReplication *sbr,
+int AAC_RENAME(ff_decode_sbr_extension)(AACDecContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb_host, int crc, int cnt, int id_aac)
{
unsigned int num_sbr_bits = 0, num_align_bits;
@@ -1243,7 +1243,7 @@ static void sbr_qmf_synthesis(AVTXContext *mdct, av_tx_fn mdct_fn,
#endif
/// Generate the subband filtered lowband
-static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_lf_gen(AACDecContext *ac, SpectralBandReplication *sbr,
INTFLOAT X_low[32][40][2], const INTFLOAT W[2][32][32][2],
int buf_idx)
{
@@ -1268,7 +1268,7 @@ static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr,
}
/// High Frequency Generator (14496-3 sp04 p215)
-static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_hf_gen(AACDecContext *ac, SpectralBandReplication *sbr,
INTFLOAT X_high[64][40][2], const INTFLOAT X_low[32][40][2],
const INTFLOAT (*alpha0)[2], const INTFLOAT (*alpha1)[2],
const INTFLOAT bw_array[5], const uint8_t *t_env,
@@ -1342,7 +1342,7 @@ static int sbr_x_gen(SpectralBandReplication *sbr, INTFLOAT X[2][38][64],
/** High Frequency Adjustment (14496-3 sp04 p217) and Mapping
* (14496-3 sp04 p217)
*/
-static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_mapping(AACDecContext *ac, SpectralBandReplication *sbr,
SBRData *ch_data, int e_a[2])
{
int e, i, m;
@@ -1456,7 +1456,7 @@ static void sbr_env_estimate(AAC_FLOAT (*e_curr)[48], INTFLOAT X_high[64][40][2]
}
}
-void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
+void AAC_RENAME(ff_sbr_apply)(AACDecContext *ac, SpectralBandReplication *sbr, int id_aac,
INTFLOAT* L, INTFLOAT* R)
{
int downsampled = ac->oc[1].m4ac.ext_sample_rate < sbr->sample_rate;
diff --git a/libavcodec/mips/aacdec_mips.c b/libavcodec/mips/aacdec_mips.c
index f4b0767e3b..456e270915 100644
--- a/libavcodec/mips/aacdec_mips.c
+++ b/libavcodec/mips/aacdec_mips.c
@@ -112,7 +112,7 @@ static av_always_inline int lcg_random(unsigned previous_val)
return v.s;
}
-static void imdct_and_windowing_mips(AACContext *ac, SingleChannelElement *sce)
+static void imdct_and_windowing_mips(AACDecContext *ac, SingleChannelElement *sce)
{
IndividualChannelStream *ics = &sce->ics;
float *in = sce->coeffs;
@@ -224,7 +224,7 @@ static void imdct_and_windowing_mips(AACContext *ac, SingleChannelElement *sce)
}
}
-static void apply_ltp_mips(AACContext *ac, SingleChannelElement *sce)
+static void apply_ltp_mips(AACDecContext *ac, SingleChannelElement *sce)
{
const LongTermPrediction *ltp = &sce->ics.ltp;
const uint16_t *offsets = sce->ics.swb_offset;
@@ -334,7 +334,7 @@ static av_always_inline void fmul_and_reverse(float *dst, const float *src0, con
}
}
-static void update_ltp_mips(AACContext *ac, SingleChannelElement *sce)
+static void update_ltp_mips(AACDecContext *ac, SingleChannelElement *sce)
{
IndividualChannelStream *ics = &sce->ics;
float *saved = sce->saved;
@@ -431,7 +431,7 @@ static void update_ltp_mips(AACContext *ac, SingleChannelElement *sce)
#endif /* HAVE_MIPSFPU */
#endif /* HAVE_INLINE_ASM */
-void ff_aacdec_init_mips(AACContext *c)
+void ff_aacdec_init_mips(AACDecContext *c)
{
#if HAVE_INLINE_ASM
#if HAVE_MIPSFPU
diff --git a/libavcodec/mips/aacsbr_mips.c b/libavcodec/mips/aacsbr_mips.c
index 546e528895..0dc09130b7 100644
--- a/libavcodec/mips/aacsbr_mips.c
+++ b/libavcodec/mips/aacsbr_mips.c
@@ -60,7 +60,7 @@
#if HAVE_INLINE_ASM
#if HAVE_MIPSFPU
-static int sbr_lf_gen_mips(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_lf_gen_mips(AACDecContext *ac, SpectralBandReplication *sbr,
float X_low[32][40][2], const float W[2][32][32][2],
int buf_idx)
{
diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h
index f949465ef5..46c68615c8 100644
--- a/libavcodec/sbr.h
+++ b/libavcodec/sbr.h
@@ -37,7 +37,7 @@
#include "aacps.h"
#include "sbrdsp.h"
-typedef struct AACContext AACContext;
+struct AACDecContext;
/**
* Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header.
@@ -121,7 +121,7 @@ typedef struct SpectralBandReplication SpectralBandReplication;
* aacsbr functions pointers
*/
typedef struct AACSBRContext {
- int (*sbr_lf_gen)(AACContext *ac, SpectralBandReplication *sbr,
+ int (*sbr_lf_gen)(struct AACDecContext *ac, SpectralBandReplication *sbr,
INTFLOAT X_low[32][40][2], const INTFLOAT W[2][32][32][2],
int buf_idx);
void (*sbr_hf_assemble)(INTFLOAT Y1[38][64][2],
1
0
26 Feb '24
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Sun Feb 25 22:02:15 2024 +0100| [1b048dd443a0849ab5f3df741f0c7bc854cf13b5] | committer: Andreas Rheinhardt
avcodec/aacsbr: Remove unused parameter from sbr_gain_calc
Reviewed-by: Lynne <dev(a)lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b048dd443a0849ab…
---
libavcodec/aacsbr.c | 2 +-
libavcodec/aacsbr_fixed.c | 2 +-
libavcodec/aacsbr_template.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index da9e160a57..aafc00049a 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -233,7 +233,7 @@ static void sbr_chirp(SpectralBandReplication *sbr, SBRData *ch_data)
* Calculation of levels of additional HF signal components (14496-3 sp04 p219)
* and Calculation of gain (14496-3 sp04 p219)
*/
-static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
+static void sbr_gain_calc(SpectralBandReplication *sbr,
SBRData *ch_data, const int e_a[2])
{
int e, k, m;
diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
index 3dbda32447..06d07e1941 100644
--- a/libavcodec/aacsbr_fixed.c
+++ b/libavcodec/aacsbr_fixed.c
@@ -394,7 +394,7 @@ static void sbr_chirp(SpectralBandReplication *sbr, SBRData *ch_data)
* Calculation of levels of additional HF signal components (14496-3 sp04 p219)
* and Calculation of gain (14496-3 sp04 p219)
*/
-static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
+static void sbr_gain_calc(SpectralBandReplication *sbr,
SBRData *ch_data, const int e_a[2])
{
int e, k, m;
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index ba8e3495b4..e0725b6363 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -1513,7 +1513,7 @@ void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int
err = sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
if (!err) {
sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]);
- sbr_gain_calc(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
+ sbr_gain_calc(sbr, &sbr->data[ch], sbr->data[ch].e_a);
sbr->c.sbr_hf_assemble(sbr->data[ch].Y[sbr->data[ch].Ypos],
(const INTFLOAT (*)[40][2]) sbr->X_high,
sbr, &sbr->data[ch],
1
0
26 Feb '24
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Sun Feb 25 21:44:12 2024 +0100| [a0fa6b6030e7c118c7c41e9c15c80c61ba0a1bae] | committer: Andreas Rheinhardt
avocdec/aac: Move decoder-only stuff to new header aacdec.h
AACContext is not used by the encoder at all.
Reviewed-by: Lynne <dev(a)lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a0fa6b6030e7c118c…
---
libavcodec/aac.h | 143 ---------------------------------
libavcodec/aacdec.c | 1 +
libavcodec/aacdec.h | 179 ++++++++++++++++++++++++++++++++++++++++++
libavcodec/aacdec_fixed.c | 1 +
libavcodec/aacsbr_template.c | 2 +
libavcodec/mips/aacdec_mips.c | 2 +-
libavcodec/mips/aacdec_mips.h | 2 +-
libavcodec/mips/aacsbr_mips.c | 2 +-
libavcodec/mips/aacsbr_mips.h | 2 +-
9 files changed, 187 insertions(+), 147 deletions(-)
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index 285d3b7482..da683b0071 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -33,12 +33,7 @@
#include "aac_defines.h"
#include "libavutil/channel_layout.h"
-#include "libavutil/float_dsp.h"
-#include "libavutil/fixed_dsp.h"
#include "libavutil/mem_internal.h"
-#include "libavutil/tx.h"
-#include "avcodec.h"
-#include "mpeg4audio.h"
#include "sbr.h"
#include <stdint.h>
@@ -108,25 +103,6 @@ enum CouplingPoint {
AFTER_IMDCT = 3,
};
-/**
- * Output configuration status
- */
-enum OCStatus {
- OC_NONE, ///< Output unconfigured
- OC_TRIAL_PCE, ///< Output configuration under trial specified by an inband PCE
- OC_TRIAL_FRAME, ///< Output configuration under trial specified by a frame header
- OC_GLOBAL_HDR, ///< Output configuration set in a global header but not yet locked
- OC_LOCKED, ///< Output configuration locked in place
-};
-
-typedef struct OutputConfiguration {
- MPEG4AudioConfig m4ac;
- uint8_t layout_map[MAX_ELEM_ID*4][3];
- int layout_map_tags;
- AVChannelLayout ch_layout;
- enum OCStatus status;
-} OutputConfiguration;
-
/**
* Predictor State
*/
@@ -203,22 +179,6 @@ typedef struct TemporalNoiseShaping {
INTFLOAT coef[8][4][TNS_MAX_ORDER];
} TemporalNoiseShaping;
-/**
- * Dynamic Range Control - decoded from the bitstream but not processed further.
- */
-typedef struct DynamicRangeControl {
- int pce_instance_tag; ///< Indicates with which program the DRC info is associated.
- int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative
- int dyn_rng_ctl[17]; ///< DRC magnitude information
- int exclude_mask[MAX_CHANNELS]; ///< Channels to be excluded from DRC processing.
- int band_incr; ///< Number of DRC bands greater than 1 having DRC info.
- int interpolation_scheme; ///< Indicates the interpolation scheme used in the SBR QMF domain.
- int band_top[17]; ///< Indicates the top of the i-th DRC band in units of 4 spectral lines.
- int prog_ref_level; /**< A reference level for the long-term program audio level for all
- * channels combined.
- */
-} DynamicRangeControl;
-
typedef struct Pulse {
int num_pulse;
int start;
@@ -285,107 +245,4 @@ typedef struct ChannelElement {
SpectralBandReplication sbr;
} ChannelElement;
-enum AACOutputChannelOrder {
- CHANNEL_ORDER_DEFAULT,
- CHANNEL_ORDER_CODED,
-};
-
-/**
- * main AAC context
- */
-struct AACContext {
- AVClass *class;
- AVCodecContext *avctx;
- AVFrame *frame;
-
- int is_saved; ///< Set if elements have stored overlap from previous frame.
- DynamicRangeControl che_drc;
-
- /**
- * @name Channel element related data
- * @{
- */
- ChannelElement *che[4][MAX_ELEM_ID];
- ChannelElement *tag_che_map[4][MAX_ELEM_ID];
- int tags_mapped;
- int warned_remapping_once;
- /** @} */
-
- /**
- * @name temporary aligned temporary buffers
- * (We do not want to have these on the stack.)
- * @{
- */
- DECLARE_ALIGNED(32, INTFLOAT, buf_mdct)[1024];
- /** @} */
-
- /**
- * @name Computed / set up during initialization
- * @{
- */
- AVTXContext *mdct120;
- AVTXContext *mdct128;
- AVTXContext *mdct480;
- AVTXContext *mdct512;
- AVTXContext *mdct960;
- AVTXContext *mdct1024;
- AVTXContext *mdct_ltp;
-
- av_tx_fn mdct120_fn;
- av_tx_fn mdct128_fn;
- av_tx_fn mdct480_fn;
- av_tx_fn mdct512_fn;
- av_tx_fn mdct960_fn;
- av_tx_fn mdct1024_fn;
- av_tx_fn mdct_ltp_fn;
-#if USE_FIXED
- AVFixedDSPContext *fdsp;
-#else
- AVFloatDSPContext *fdsp;
-#endif /* USE_FIXED */
- int random_state;
- /** @} */
-
- /**
- * @name Members used for output
- * @{
- */
- SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement
- /** @} */
-
-
- /**
- * @name Japanese DTV specific extension
- * @{
- */
- int force_dmono_mode;///< 0->not dmono, 1->use first channel, 2->use second channel
- int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel
- /** @} */
-
- enum AACOutputChannelOrder output_channel_order;
-
- DECLARE_ALIGNED(32, INTFLOAT, temp)[128];
-
- OutputConfiguration oc[2];
- int warned_num_aac_frames;
- int warned_960_sbr;
- unsigned warned_71_wide;
- int warned_gain_control;
- int warned_he_aac_mono;
-
- /* aacdec functions pointers */
- void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce);
- void (*apply_ltp)(AACContext *ac, SingleChannelElement *sce);
- void (*apply_tns)(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
- IndividualChannelStream *ics, int decode);
- void (*windowing_and_mdct_ltp)(AACContext *ac, INTFLOAT *out,
- INTFLOAT *in, IndividualChannelStream *ics);
- void (*update_ltp)(AACContext *ac, SingleChannelElement *sce);
- void (*vector_pow43)(int *coefs, int len);
- void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context);
-
-};
-
-void ff_aacdec_init_mips(AACContext *c);
-
#endif /* AVCODEC_AAC_H */
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index d66ebf4a7c..962b1705c6 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -45,6 +45,7 @@
#include "sinewin.h"
#include "aac.h"
+#include "aacdec.h"
#include "aactab.h"
#include "aacdectab.h"
#include "adts_header.h"
diff --git a/libavcodec/aacdec.h b/libavcodec/aacdec.h
new file mode 100644
index 0000000000..c4ac63e2fb
--- /dev/null
+++ b/libavcodec/aacdec.h
@@ -0,0 +1,179 @@
+/*
+ * AAC decoder definitions and structures
+ * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
+ * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail 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
+ */
+
+/**
+ * @file
+ * AAC decoder definitions and structures
+ * @author Oded Shimon ( ods15 ods15 dyndns org )
+ * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
+ */
+
+#ifndef AVCODEC_AACDEC_H
+#define AVCODEC_AACDEC_H
+
+#include "libavutil/float_dsp.h"
+#include "libavutil/fixed_dsp.h"
+#include "libavutil/mem_internal.h"
+#include "libavutil/tx.h"
+
+#include "aac.h"
+#include "mpeg4audio.h"
+
+/**
+ * Output configuration status
+ */
+enum OCStatus {
+ OC_NONE, ///< Output unconfigured
+ OC_TRIAL_PCE, ///< Output configuration under trial specified by an inband PCE
+ OC_TRIAL_FRAME, ///< Output configuration under trial specified by a frame header
+ OC_GLOBAL_HDR, ///< Output configuration set in a global header but not yet locked
+ OC_LOCKED, ///< Output configuration locked in place
+};
+
+enum AACOutputChannelOrder {
+ CHANNEL_ORDER_DEFAULT,
+ CHANNEL_ORDER_CODED,
+};
+
+typedef struct OutputConfiguration {
+ MPEG4AudioConfig m4ac;
+ uint8_t layout_map[MAX_ELEM_ID*4][3];
+ int layout_map_tags;
+ AVChannelLayout ch_layout;
+ enum OCStatus status;
+} OutputConfiguration;
+
+/**
+ * Dynamic Range Control - decoded from the bitstream but not processed further.
+ */
+typedef struct DynamicRangeControl {
+ int pce_instance_tag; ///< Indicates with which program the DRC info is associated.
+ int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative
+ int dyn_rng_ctl[17]; ///< DRC magnitude information
+ int exclude_mask[MAX_CHANNELS]; ///< Channels to be excluded from DRC processing.
+ int band_incr; ///< Number of DRC bands greater than 1 having DRC info.
+ int interpolation_scheme; ///< Indicates the interpolation scheme used in the SBR QMF domain.
+ int band_top[17]; ///< Indicates the top of the i-th DRC band in units of 4 spectral lines.
+ int prog_ref_level; /**< A reference level for the long-term program audio level for all
+ * channels combined.
+ */
+} DynamicRangeControl;
+
+/**
+ * main AAC decoding context
+ */
+struct AACContext {
+ const struct AVClass *class;
+ struct AVCodecContext *avctx;
+ struct AVFrame *frame;
+
+ int is_saved; ///< Set if elements have stored overlap from previous frame.
+ DynamicRangeControl che_drc;
+
+ /**
+ * @name Channel element related data
+ * @{
+ */
+ ChannelElement *che[4][MAX_ELEM_ID];
+ ChannelElement *tag_che_map[4][MAX_ELEM_ID];
+ int tags_mapped;
+ int warned_remapping_once;
+ /** @} */
+
+ /**
+ * @name temporary aligned temporary buffers
+ * (We do not want to have these on the stack.)
+ * @{
+ */
+ DECLARE_ALIGNED(32, INTFLOAT, buf_mdct)[1024];
+ /** @} */
+
+ /**
+ * @name Computed / set up during initialization
+ * @{
+ */
+ AVTXContext *mdct120;
+ AVTXContext *mdct128;
+ AVTXContext *mdct480;
+ AVTXContext *mdct512;
+ AVTXContext *mdct960;
+ AVTXContext *mdct1024;
+ AVTXContext *mdct_ltp;
+
+ av_tx_fn mdct120_fn;
+ av_tx_fn mdct128_fn;
+ av_tx_fn mdct480_fn;
+ av_tx_fn mdct512_fn;
+ av_tx_fn mdct960_fn;
+ av_tx_fn mdct1024_fn;
+ av_tx_fn mdct_ltp_fn;
+#if USE_FIXED
+ AVFixedDSPContext *fdsp;
+#else
+ AVFloatDSPContext *fdsp;
+#endif /* USE_FIXED */
+ int random_state;
+ /** @} */
+
+ /**
+ * @name Members used for output
+ * @{
+ */
+ SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement
+ /** @} */
+
+
+ /**
+ * @name Japanese DTV specific extension
+ * @{
+ */
+ int force_dmono_mode;///< 0->not dmono, 1->use first channel, 2->use second channel
+ int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel
+ /** @} */
+
+ enum AACOutputChannelOrder output_channel_order;
+
+ DECLARE_ALIGNED(32, INTFLOAT, temp)[128];
+
+ OutputConfiguration oc[2];
+ int warned_num_aac_frames;
+ int warned_960_sbr;
+ unsigned warned_71_wide;
+ int warned_gain_control;
+ int warned_he_aac_mono;
+
+ /* aacdec functions pointers */
+ void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce);
+ void (*apply_ltp)(AACContext *ac, SingleChannelElement *sce);
+ void (*apply_tns)(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
+ IndividualChannelStream *ics, int decode);
+ void (*windowing_and_mdct_ltp)(AACContext *ac, INTFLOAT *out,
+ INTFLOAT *in, IndividualChannelStream *ics);
+ void (*update_ltp)(AACContext *ac, SingleChannelElement *sce);
+ void (*vector_pow43)(int *coefs, int len);
+ void (*subband_scale)(int *dst, int *src, int scale, int offset, int len, void *log_context);
+
+};
+
+void ff_aacdec_init_mips(AACContext *c);
+
+#endif /* AVCODEC_AACDEC_H */
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index 2b8ac67659..19662cb7e6 100644
--- a/libavcodec/aacdec_fixed.c
+++ b/libavcodec/aacdec_fixed.c
@@ -71,6 +71,7 @@
#include "sinewin_fixed_tablegen.h"
#include "aac.h"
+#include "aacdec.h"
#include "aactab.h"
#include "aacdectab.h"
#include "adts_header.h"
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index 98e9fd8fed..ba8e3495b4 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -32,7 +32,9 @@
* @author Zoran Basaric ( zoran.basaric(a)imgtec.com )
*/
+#include "aacdec.h"
#include "aacdectab.h"
+#include "avcodec.h"
#include "libavutil/qsort.h"
static av_cold void aacsbr_tableinit(void)
diff --git a/libavcodec/mips/aacdec_mips.c b/libavcodec/mips/aacdec_mips.c
index cd357cedbc..f4b0767e3b 100644
--- a/libavcodec/mips/aacdec_mips.c
+++ b/libavcodec/mips/aacdec_mips.c
@@ -53,7 +53,7 @@
*/
#include "libavutil/attributes.h"
-#include "libavcodec/aac.h"
+#include "libavcodec/aacdec.h"
#include "aacdec_mips.h"
#include "libavcodec/aactab.h"
#include "libavcodec/sinewin.h"
diff --git a/libavcodec/mips/aacdec_mips.h b/libavcodec/mips/aacdec_mips.h
index 758266fc16..71581986dc 100644
--- a/libavcodec/mips/aacdec_mips.h
+++ b/libavcodec/mips/aacdec_mips.h
@@ -57,7 +57,7 @@
#ifndef AVCODEC_MIPS_AACDEC_MIPS_H
#define AVCODEC_MIPS_AACDEC_MIPS_H
-#include "libavcodec/aac.h"
+#include "libavcodec/aacdec.h"
#include "libavutil/mips/asmdefs.h"
#if HAVE_INLINE_ASM && HAVE_MIPSFPU
diff --git a/libavcodec/mips/aacsbr_mips.c b/libavcodec/mips/aacsbr_mips.c
index 33fd9b229e..546e528895 100644
--- a/libavcodec/mips/aacsbr_mips.c
+++ b/libavcodec/mips/aacsbr_mips.c
@@ -51,7 +51,7 @@
* Reference: libavcodec/aacsbr.c
*/
-#include "libavcodec/aac.h"
+#include "libavcodec/aacdec.h"
#include "libavcodec/aacsbr.h"
#include "libavutil/mem_internal.h"
#include "libavutil/mips/asmdefs.h"
diff --git a/libavcodec/mips/aacsbr_mips.h b/libavcodec/mips/aacsbr_mips.h
index 4750c94024..447393164a 100644
--- a/libavcodec/mips/aacsbr_mips.h
+++ b/libavcodec/mips/aacsbr_mips.h
@@ -54,7 +54,7 @@
#ifndef AVCODEC_MIPS_AACSBR_MIPS_H
#define AVCODEC_MIPS_AACSBR_MIPS_H
-#include "libavcodec/aac.h"
+#include "libavcodec/aacdec.h"
#include "libavcodec/sbr.h"
#include "libavutil/mips/asmdefs.h"
1
0
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Sun Feb 25 21:37:38 2024 +0100| [c6cf253c98a7839d852f7f707979c8401a26459c] | committer: Andreas Rheinhardt
avcodec/aacdec_template: Don't use intermediate void*
Reviewed-by: Lynne <dev(a)lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6cf253c98a7839d8…
---
libavcodec/aacdec_template.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index fa2a68535c..cfaa25873f 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -3032,7 +3032,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
return size;
}
-static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
+static int aac_decode_er_frame(AVCodecContext *avctx, AVFrame *frame,
int *got_frame_ptr, GetBitContext *gb)
{
AACContext *ac = avctx->priv_data;
@@ -3046,7 +3046,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
if (aot == AOT_ER_AAC_LD || aot == AOT_ER_AAC_ELD)
samples >>= 1;
- ac->frame = data;
+ ac->frame = frame;
if ((err = frame_configure_elements(avctx)) < 0)
return err;
1
0
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Fri Feb 23 18:54:10 2024 +0100| [25e0e087c4314730d42ac16061962904b8fb3ae6] | committer: Andreas Rheinhardt
configure: Disable linker warnings for common symbols
Common symbols are not part of ISO-C and therefore not used
by FFmpeg at all. Yet linker warnings to ensure it stays
that way are nevertheless wrong, because the existence of
common symbols does not imply that there is a bug in our code.
More precisely, Clang's ASAN implementation uses a common symbol
___asan_globals_registered when used on Elf targets with
the -fsanitize-address-globals-dead-stripping option;
said option is the default since Clang 17 [1].
This leads to 1883 warnings about ___asan_globals_registered
when linking here.
(Even without that option there were warnings like
_ZN14__interception10real_vforkE being overridden.)
Said warning is also unnecessary: The proper way to ensure
that our code is free of common symbols is to let the compiler
enforce this. But this is already the default since GCC 10
and Clang 11, so there is no risk of introducing our own
common symbols.
[1]: https://reviews.llvm.org/D152604
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=25e0e087c4314730d…
---
configure | 1 -
1 file changed, 1 deletion(-)
diff --git a/configure b/configure
index 2d0e6a444a..bb5e630bad 100755
--- a/configure
+++ b/configure
@@ -7337,7 +7337,6 @@ void (^block)(void);
EOF
# add some linker flags
-check_ldflags -Wl,--warn-common
check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
1
0
ffmpeg | branch: master | James Almer <jamrial(a)gmail.com> | Sat Feb 10 18:46:15 2024 -0300| [84e669167de9394e0de1bee0244f48ffac6f3826] | committer: James Almer
fate/mov: add tests for HEIF samples with derived images
Signed-off-by: James Almer <jamrial(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84e669167de9394e0…
---
tests/fate/mov.mak | 8 +++++++
tests/ref/fate/mov-heic-demux-still-image-grid | 32 ++++++++++++++++++++++++++
tests/ref/fate/mov-heic-demux-still-image-iovl | 18 +++++++++++++++
3 files changed, 58 insertions(+)
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 069ae65324..535647c474 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -161,6 +161,14 @@ FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, HEVC, HEVC_PARSER) \
+= fate-mov-heic-demux-still-image-multiple-items
fate-mov-heic-demux-still-image-multiple-items: CMD = framemd5 -i $(TARGET_SAMPLES)/heif-conformance/C003.heic -c:v copy -map 0
+FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, HEVC, HEVC_PARSER) \
+ += fate-mov-heic-demux-still-image-grid
+fate-mov-heic-demux-still-image-grid: CMD = framemd5 -i $(TARGET_SAMPLES)/heif-conformance/C007.heic -c:v copy -map 0:g:0
+
+FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, HEVC, HEVC_PARSER) \
+ += fate-mov-heic-demux-still-image-iovl
+fate-mov-heic-demux-still-image-iovl: CMD = framemd5 -i $(TARGET_SAMPLES)/heif-conformance/C015.heic -c:v copy -map 0:g:0
+
# Resulting remux should have:
# 1. first audio stream with AV_DISPOSITION_HEARING_IMPAIRED
# 2. second audio stream with AV_DISPOSITION_VISUAL_IMPAIRED | DESCRIPTIONS
diff --git a/tests/ref/fate/mov-heic-demux-still-image-grid b/tests/ref/fate/mov-heic-demux-still-image-grid
new file mode 100644
index 0000000000..6fde8fff28
--- /dev/null
+++ b/tests/ref/fate/mov-heic-demux-still-image-grid
@@ -0,0 +1,32 @@
+#format: frame checksums
+#version: 2
+#hash: MD5
+#extradata 0, 100, 5444bf01e03182c73ae957179d560f4d
+#extradata 1, 100, 5444bf01e03182c73ae957179d560f4d
+#extradata 2, 100, 5444bf01e03182c73ae957179d560f4d
+#extradata 3, 100, 5444bf01e03182c73ae957179d560f4d
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: hevc
+#dimensions 0: 1280x720
+#sar 0: 0/1
+#tb 1: 1/1
+#media_type 1: video
+#codec_id 1: hevc
+#dimensions 1: 1280x720
+#sar 1: 0/1
+#tb 2: 1/1
+#media_type 2: video
+#codec_id 2: hevc
+#dimensions 2: 1280x720
+#sar 2: 0/1
+#tb 3: 1/1
+#media_type 3: video
+#codec_id 3: hevc
+#dimensions 3: 1280x720
+#sar 3: 0/1
+#stream#, dts, pts, duration, size, hash
+0, 0, 0, 1, 111554, 03ceabfab39afd2e2e796b9362111f32
+1, 0, 0, 1, 111481, e5db978adbe4de7ee50fe73abc39fcfa
+2, 0, 0, 1, 111451, 08700213113cadbb6628ecb8253c1c2a
+3, 0, 0, 1, 111353, 5de942e14c848e5e22fad5d88fb13776
diff --git a/tests/ref/fate/mov-heic-demux-still-image-iovl b/tests/ref/fate/mov-heic-demux-still-image-iovl
new file mode 100644
index 0000000000..753cef267a
--- /dev/null
+++ b/tests/ref/fate/mov-heic-demux-still-image-iovl
@@ -0,0 +1,18 @@
+#format: frame checksums
+#version: 2
+#hash: MD5
+#extradata 0, 100, 5444bf01e03182c73ae957179d560f4d
+#extradata 1, 100, 5444bf01e03182c73ae957179d560f4d
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: hevc
+#dimensions 0: 1280x720
+#sar 0: 0/1
+#tb 1: 1/1
+#media_type 1: video
+#codec_id 1: hevc
+#dimensions 1: 1280x720
+#sar 1: 0/1
+#stream#, dts, pts, duration, size, hash
+0, 0, 0, 1, 111554, 03ceabfab39afd2e2e796b9362111f32
+1, 0, 0, 1, 112393, daa001d351c088a5bc328459e2501c95
1
0
ffmpeg | branch: master | James Almer <jamrial(a)gmail.com> | Mon Jan 22 15:00:26 2024 -0300| [feab8f9c58cefa878c2dc0bfa13b0d33cf400c22] | committer: James Almer
fate/mov: test remuxing all stream heif items
Signed-off-by: James Almer <jamrial(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=feab8f9c58cefa878…
---
tests/fate/mov.mak | 2 +-
tests/ref/fate/mov-heic-demux-still-image-multiple-items | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index de1dfa16a2..069ae65324 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -159,7 +159,7 @@ fate-mov-heic-demux-still-image-1-item: CMD = framemd5 -i $(TARGET_SAMPLES)/heif
FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, HEVC, HEVC_PARSER) \
+= fate-mov-heic-demux-still-image-multiple-items
-fate-mov-heic-demux-still-image-multiple-items: CMD = framemd5 -i $(TARGET_SAMPLES)/heif-conformance/C003.heic -c:v copy
+fate-mov-heic-demux-still-image-multiple-items: CMD = framemd5 -i $(TARGET_SAMPLES)/heif-conformance/C003.heic -c:v copy -map 0
# Resulting remux should have:
# 1. first audio stream with AV_DISPOSITION_HEARING_IMPAIRED
diff --git a/tests/ref/fate/mov-heic-demux-still-image-multiple-items b/tests/ref/fate/mov-heic-demux-still-image-multiple-items
index c850c1ff9c..753cef267a 100644
--- a/tests/ref/fate/mov-heic-demux-still-image-multiple-items
+++ b/tests/ref/fate/mov-heic-demux-still-image-multiple-items
@@ -2,10 +2,17 @@
#version: 2
#hash: MD5
#extradata 0, 100, 5444bf01e03182c73ae957179d560f4d
+#extradata 1, 100, 5444bf01e03182c73ae957179d560f4d
#tb 0: 1/1
#media_type 0: video
#codec_id 0: hevc
#dimensions 0: 1280x720
#sar 0: 0/1
+#tb 1: 1/1
+#media_type 1: video
+#codec_id 1: hevc
+#dimensions 1: 1280x720
+#sar 1: 0/1
#stream#, dts, pts, duration, size, hash
0, 0, 0, 1, 111554, 03ceabfab39afd2e2e796b9362111f32
+1, 0, 0, 1, 112393, daa001d351c088a5bc328459e2501c95
1
0
ffmpeg | branch: master | James Almer <jamrial(a)gmail.com> | Mon Jan 22 14:35:55 2024 -0300| [41e349c24a726d0c3bac5830eec9f6940ea41c63] | committer: James Almer
avformat/mov: add support for tile HEIF still images
Export each tile as its own stream, and the grid information as a Stream Group
of type TILE_GRID.
This also enables exporting other stream items like thumbnails, which may be
present in non tiled HEIF images too. For those, the primary stream will be
tagged with the default disposition.
Based on a patch by Swaraj Hota
Signed-off-by: James Almer <jamrial(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41e349c24a726d0c3…
---
doc/APIchanges | 4 +
libavformat/avformat.c | 8 +
libavformat/avformat.h | 6 +-
libavformat/internal.h | 5 +
libavformat/isom.h | 14 +-
libavformat/mov.c | 494 ++++++++++++++++++++++++++++++++++++++++++++-----
libavformat/version.h | 2 +-
7 files changed, 484 insertions(+), 49 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index d8b48e2915..10f6667e9e 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09
API changes, most recent first:
+2024-02-26 - xxxxxxxxxx - lavf 60.22.101 - avformat.h
+ AV_DISPOSITION_DEPENDENT may now also be used for video streams
+ intended to be merged with other video streams for presentation.
+
2024-02-26 - xxxxxxxxxx - lavf 60.22.100 - avformat.h
Add AVStreamGroupTileGrid
Add AV_STREAM_GROUP_PARAMS_TILE_GRID
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index f53ba4ce58..eb898223d2 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -119,6 +119,14 @@ void ff_remove_stream(AVFormatContext *s, AVStream *st)
ff_free_stream(&s->streams[ --s->nb_streams ]);
}
+void ff_remove_stream_group(AVFormatContext *s, AVStreamGroup *stg)
+{
+ av_assert0(s->nb_stream_groups > 0);
+ av_assert0(s->stream_groups[ s->nb_stream_groups - 1 ] == stg);
+
+ ff_free_stream_group(&s->stream_groups[ --s->nb_stream_groups ]);
+}
+
/* XXX: suppress the packet queue */
void ff_flush_packet_queue(AVFormatContext *s)
{
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index c3de1fdafc..f4506f4cf1 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -802,9 +802,9 @@ typedef struct AVIndexEntry {
*/
#define AV_DISPOSITION_METADATA (1 << 18)
/**
- * The audio stream is intended to be mixed with another stream before
- * presentation.
- * Corresponds to mix_type=0 in mpegts.
+ * The stream is intended to be mixed with another stream before presentation.
+ * Used for example to signal the stream contains an image part of a HEIF grid,
+ * or for mix_type=0 in mpegts.
*/
#define AV_DISPOSITION_DEPENDENT (1 << 19)
/**
diff --git a/libavformat/internal.h b/libavformat/internal.h
index c66f959e9f..5603ca1ab5 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -637,6 +637,11 @@ void ff_remove_stream(AVFormatContext *s, AVStream *st);
* is not yet attached to an AVFormatContext.
*/
void ff_free_stream_group(AVStreamGroup **pstg);
+/**
+ * Remove a stream group from its AVFormatContext and free it.
+ * The stream group must be the last stream group of the AVFormatContext.
+ */
+void ff_remove_stream_group(AVFormatContext *s, AVStreamGroup *stg);
unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 25025e4cee..07f09d6eff 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -271,15 +271,23 @@ typedef struct MOVStreamContext {
typedef struct HEIFItem {
AVStream *st;
+ char *name;
int item_id;
int64_t extent_length;
int64_t extent_offset;
- int64_t size;
int width;
int height;
int type;
+ int is_idat_relative;
} HEIFItem;
+typedef struct HEIFGrid {
+ HEIFItem *item;
+ HEIFItem **tile_item_list;
+ int16_t *tile_id_list;
+ int nb_tiles;
+} HEIFGrid;
+
typedef struct MOVContext {
const AVClass *class; ///< class for private options
AVFormatContext *fc;
@@ -343,6 +351,10 @@ typedef struct MOVContext {
int cur_item_id;
HEIFItem *heif_item;
int nb_heif_item;
+ HEIFGrid *heif_grid;
+ int nb_heif_grid;
+ int thmb_item_id;
+ int64_t idat_offset;
int interleaved_read;
} MOVContext;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1a1b104615..effa46120f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -187,6 +187,30 @@ static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len,
return p - dst;
}
+static AVStream *get_curr_st(MOVContext *c)
+{
+ AVStream *st = NULL;
+
+ if (c->fc->nb_streams < 1)
+ return NULL;
+
+ for (int i = 0; i < c->nb_heif_item; i++) {
+ HEIFItem *item = &c->heif_item[i];
+
+ if (!item->st)
+ continue;
+ if (item->st->id != c->cur_item_id)
+ continue;
+
+ st = item->st;
+ break;
+ }
+ if (!st)
+ st = c->fc->streams[c->fc->nb_streams-1];
+
+ return st;
+}
+
static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len)
{
AVStream *st;
@@ -1901,9 +1925,9 @@ static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint16_t color_primaries, color_trc, color_matrix;
int ret;
- if (c->fc->nb_streams < 1)
+ st = get_curr_st(c);
+ if (!st)
return 0;
- st = c->fc->streams[c->fc->nb_streams - 1];
ret = ffio_read_size(pb, color_parameter_type, 4);
if (ret < 0)
@@ -2251,9 +2275,9 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVStream *st;
int ret;
- if (c->fc->nb_streams < 1)
+ st = get_curr_st(c);
+ if (!st)
return 0;
- st = c->fc->streams[c->fc->nb_streams-1];
if ((uint64_t)atom.size > (1<<30))
return AVERROR_INVALIDDATA;
@@ -5144,16 +5168,17 @@ static int heif_add_stream(MOVContext *c, HEIFItem *item)
st->codecpar->codec_id = mov_codec_id(st, item->type);
sc->id = st->id;
sc->ffindex = st->index;
- c->trak_index = st->index;
st->avg_frame_rate.num = st->avg_frame_rate.den = 1;
st->time_base.num = st->time_base.den = 1;
st->nb_frames = 1;
sc->time_scale = 1;
- sc = st->priv_data;
sc->pb = c->fc->pb;
sc->pb_is_copied = 1;
sc->refcount = 1;
+ if (item->name)
+ av_dict_set(&st->metadata, "title", item->name, 0);
+
// Populate the necessary fields used by mov_build_index.
sc->stsc_count = 1;
sc->stsc_data = av_malloc_array(1, sizeof(*sc->stsc_data));
@@ -8008,11 +8033,18 @@ static int mov_read_pitm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return atom.size;
}
+static int mov_read_idat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+ c->idat_offset = avio_tell(pb);
+ return 0;
+}
+
static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
+ HEIFItem *heif_item;
int version, offset_size, length_size, base_offset_size, index_size;
int item_count, extent_count;
- uint64_t base_offset, extent_offset, extent_length;
+ int64_t base_offset, extent_offset, extent_length;
uint8_t value;
if (c->found_moov) {
@@ -8031,17 +8063,20 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
base_offset_size = (value >> 4) & 0xF;
index_size = !version ? 0 : (value & 0xF);
if (index_size) {
- av_log(c->fc, AV_LOG_ERROR, "iloc: index_size != 0 not supported.\n");
+ avpriv_report_missing_feature(c->fc, "iloc: index_size != 0");
return AVERROR_PATCHWELCOME;
}
item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
- if (!c->heif_item) {
- c->heif_item = av_calloc(item_count, sizeof(*c->heif_item));
- if (!c->heif_item)
- return AVERROR(ENOMEM);
- c->nb_heif_item = item_count;
- }
+ heif_item = av_realloc_array(c->heif_item, item_count, sizeof(*c->heif_item));
+ if (!heif_item)
+ return AVERROR(ENOMEM);
+ c->heif_item = heif_item;
+ if (item_count > c->nb_heif_item)
+ memset(c->heif_item + c->nb_heif_item, 0,
+ sizeof(*c->heif_item) * (item_count - c->nb_heif_item));
+ c->nb_heif_item = FFMAX(c->nb_heif_item, item_count);
+ c->cur_item_id = 0;
av_log(c->fc, AV_LOG_TRACE, "iloc: item_count %d\n", item_count);
for (int i = 0; i < item_count; i++) {
@@ -8051,7 +8086,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (avio_feof(pb))
return AVERROR_INVALIDDATA;
if (offset_type > 1) {
- avpriv_request_sample(c->fc, "iloc offset type %d", offset_type);
+ avpriv_report_missing_feature(c->fc, "iloc offset type %d", offset_type);
return AVERROR_PATCHWELCOME;
}
c->heif_item[i].item_id = item_id;
@@ -8062,13 +8097,15 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
extent_count = avio_rb16(pb);
if (extent_count > 1) {
// For still AVIF images, we only support one extent item.
- av_log(c->fc, AV_LOG_ERROR, "iloc: extent_count > 1 not supported\n");
+ avpriv_report_missing_feature(c->fc, "iloc: extent_count > 1");
return AVERROR_PATCHWELCOME;
}
for (int j = 0; j < extent_count; j++) {
if (rb_size(pb, &extent_offset, offset_size) < 0 ||
rb_size(pb, &extent_length, length_size) < 0)
return AVERROR_INVALIDDATA;
+ if (offset_type == 1)
+ c->heif_item[i].is_idat_relative = 1;
c->heif_item[i].extent_length = extent_length;
c->heif_item[i].extent_offset = base_offset + extent_offset;
av_log(c->fc, AV_LOG_TRACE, "iloc: item_idx %d, offset_type %d, "
@@ -8083,7 +8120,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
- char item_name[128];
+ AVBPrint item_name;
int64_t size = atom.size;
uint32_t item_type;
int item_id;
@@ -8093,27 +8130,32 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_rb24(pb); // flags.
size -= 4;
- if (version != 2) {
- av_log(c->fc, AV_LOG_ERROR, "infe: version != 2 not supported\n");
+ if (version < 2) {
+ av_log(c->fc, AV_LOG_ERROR, "infe: version < 2 not supported\n");
return AVERROR_PATCHWELCOME;
}
- item_id = avio_rb16(pb);
+ item_id = version > 2 ? avio_rb32(pb) : avio_rb16(pb);
avio_rb16(pb); // item_protection_index
item_type = avio_rl32(pb);
size -= 8;
- size -= avio_get_str(pb, INT_MAX, item_name, sizeof(item_name));
- av_log(c->fc, AV_LOG_TRACE, "infe: item_id %d, item_type %s, item_name %s\n",
- item_id, av_fourcc2str(item_type), item_name);
+ av_bprint_init(&item_name, 0, AV_BPRINT_SIZE_UNLIMITED);
+ ret = ff_read_string_to_bprint_overwrite(pb, &item_name, size);
+ if (ret < 0) {
+ av_bprint_finalize(&item_name, NULL);
+ return ret;
+ }
- // Skip all but the primary item until support is added
- if (item_id != c->primary_item_id)
- return 0;
+ av_log(c->fc, AV_LOG_TRACE, "infe: item_id %d, item_type %s, item_name %s\n",
+ item_id, av_fourcc2str(item_type), item_name.str);
+ size -= ret + 1;
if (size > 0)
avio_skip(pb, size);
+ if (ret)
+ av_bprint_finalize(&item_name, &c->heif_item[c->cur_item_id].name);
c->heif_item[c->cur_item_id].item_id = item_id;
c->heif_item[c->cur_item_id].type = item_type;
@@ -8124,9 +8166,6 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (ret < 0)
return ret;
break;
- default:
- av_log(c->fc, AV_LOG_TRACE, "infe: ignoring item_type %s\n", av_fourcc2str(item_type));
- break;
}
c->cur_item_id++;
@@ -8136,6 +8175,7 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
+ HEIFItem *heif_item;
int entry_count;
int version, ret;
@@ -8153,13 +8193,14 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_rb24(pb); // flags.
entry_count = version ? avio_rb32(pb) : avio_rb16(pb);
- if (!c->heif_item) {
- c->heif_item = av_calloc(entry_count, sizeof(*c->heif_item));
- if (!c->heif_item)
- return AVERROR(ENOMEM);
- c->nb_heif_item = entry_count;
- }
-
+ heif_item = av_realloc_array(c->heif_item, entry_count, sizeof(*c->heif_item));
+ if (!heif_item)
+ return AVERROR(ENOMEM);
+ c->heif_item = heif_item;
+ if (entry_count > c->nb_heif_item)
+ memset(c->heif_item + c->nb_heif_item, 0,
+ sizeof(*c->heif_item) * (entry_count - c->nb_heif_item));
+ c->nb_heif_item = FFMAX(c->nb_heif_item, entry_count);
c->cur_item_id = 0;
for (int i = 0; i < entry_count; i++) {
@@ -8176,11 +8217,125 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
+static int mov_read_iref_dimg(MOVContext *c, AVIOContext *pb, int version)
+{
+ HEIFItem *item = NULL;
+ HEIFGrid *grid;
+ int entries, i;
+ int from_item_id = version ? avio_rb32(pb) : avio_rb16(pb);
+
+ for (int i = 0; i < c->nb_heif_grid; i++) {
+ if (c->heif_grid[i].item->item_id == from_item_id) {
+ av_log(c->fc, AV_LOG_ERROR, "More than one 'dimg' box "
+ "referencing the same Derived Image item\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ for (int i = 0; i < c->nb_heif_item; i++) {
+ if (c->heif_item[i].item_id != from_item_id)
+ continue;
+ item = &c->heif_item[i];
+
+ switch (item->type) {
+ case MKTAG('g','r','i','d'):
+ case MKTAG('i','o','v','l'):
+ break;
+ default:
+ avpriv_report_missing_feature(c->fc, "Derived Image item of type %s",
+ av_fourcc2str(item->type));
+ return 0;
+ }
+ break;
+ }
+ if (!item) {
+ av_log(c->fc, AV_LOG_ERROR, "Missing grid information\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ grid = av_realloc_array(c->heif_grid, c->nb_heif_grid + 1U,
+ sizeof(*c->heif_grid));
+ if (!grid)
+ return AVERROR(ENOMEM);
+ c->heif_grid = grid;
+ grid = &grid[c->nb_heif_grid++];
+
+ entries = avio_rb16(pb);
+ grid->tile_id_list = av_malloc_array(entries, sizeof(*grid->tile_id_list));
+ grid->tile_item_list = av_calloc(entries, sizeof(*grid->tile_item_list));
+ if (!grid->tile_id_list || !grid->tile_item_list)
+ return AVERROR(ENOMEM);
+ /* 'to' item ids */
+ for (i = 0; i < entries; i++)
+ grid->tile_id_list[i] = version ? avio_rb32(pb) : avio_rb16(pb);
+ grid->nb_tiles = entries;
+ grid->item = item;
+
+ av_log(c->fc, AV_LOG_TRACE, "dimg: from_item_id %d, entries %d\n",
+ from_item_id, entries);
+
+ return 0;
+}
+
+static int mov_read_iref_thmb(MOVContext *c, AVIOContext *pb, int version)
+{
+ int entries;
+ int to_item_id, from_item_id = version ? avio_rb32(pb) : avio_rb16(pb);
+
+ entries = avio_rb16(pb);
+ if (entries > 1) {
+ avpriv_request_sample(c->fc, "thmb in iref referencing several items");
+ return AVERROR_PATCHWELCOME;
+ }
+ /* 'to' item ids */
+ to_item_id = version ? avio_rb32(pb) : avio_rb16(pb);
+
+ if (to_item_id != c->primary_item_id)
+ return 0;
+
+ c->thmb_item_id = from_item_id;
+
+ av_log(c->fc, AV_LOG_TRACE, "thmb: from_item_id %d, entries %d\n",
+ from_item_id, entries);
+
+ return 0;
+}
+
static int mov_read_iref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
- avio_rb32(pb); /* version and flags */
+ int version = avio_r8(pb);
+ avio_rb24(pb); // flags
atom.size -= 4;
- return mov_read_default(c, pb, atom);
+
+ if (version > 1) {
+ av_log(c->fc, AV_LOG_WARNING, "Unknown iref box version %d\n", version);
+ return 0;
+ }
+
+ while (atom.size) {
+ uint32_t type, size = avio_rb32(pb);
+ int64_t next = avio_tell(pb);
+
+ if (size < 14 || next < 0 || next > INT64_MAX - size)
+ return AVERROR_INVALIDDATA;
+
+ next += size - 4;
+ type = avio_rl32(pb);
+ switch (type) {
+ case MKTAG('d','i','m','g'):
+ mov_read_iref_dimg(c, pb, version);
+ break;
+ case MKTAG('t','h','m','b'):
+ mov_read_iref_thmb(c, pb, version);
+ break;
+ default:
+ av_log(c->fc, AV_LOG_DEBUG, "Unknown iref type %s size %"PRIu32"\n",
+ av_fourcc2str(type), size);
+ }
+
+ atom.size -= size;
+ avio_seek(pb, next, SEEK_SET);
+ }
+ return 0;
}
static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@@ -8303,10 +8458,6 @@ static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_log(c->fc, AV_LOG_TRACE, "ipma: property_index %d, item_id %d, item_type %s\n",
index + 1, item_id, av_fourcc2str(ref->type));
- // Skip properties referencing items other than the primary item until support is added
- if (item_id != c->primary_item_id)
- continue;
-
c->cur_item_id = item_id;
ret = mov_read_default(c, &ref->b.pub,
@@ -8435,6 +8586,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('p','c','m','C'), mov_read_pcmc }, /* PCM configuration box */
{ MKTAG('p','i','t','m'), mov_read_pitm },
{ MKTAG('e','v','c','C'), mov_read_glbl },
+{ MKTAG('i','d','a','t'), mov_read_idat },
{ MKTAG('i','r','e','f'), mov_read_iref },
{ MKTAG('i','s','p','e'), mov_read_ispe },
{ MKTAG('i','p','r','p'), mov_read_iprp },
@@ -8953,7 +9105,14 @@ static int mov_read_close(AVFormatContext *s)
av_freep(&mov->aes_decrypt);
av_freep(&mov->chapter_tracks);
+ for (i = 0; i < mov->nb_heif_item; i++)
+ av_freep(&mov->heif_item[i].name);
av_freep(&mov->heif_item);
+ for (i = 0; i < mov->nb_heif_grid; i++) {
+ av_freep(&mov->heif_grid[i].tile_id_list);
+ av_freep(&mov->heif_grid[i].tile_item_list);
+ }
+ av_freep(&mov->heif_grid);
return 0;
}
@@ -9093,6 +9252,228 @@ fail:
return ret;
}
+static int read_image_grid(AVFormatContext *s, const HEIFGrid *grid,
+ AVStreamGroupTileGrid *tile_grid)
+{
+ MOVContext *c = s->priv_data;
+ const HEIFItem *item = grid->item;
+ int64_t offset = 0, pos = avio_tell(s->pb);
+ int x = 0, y = 0, i = 0;
+ int tile_rows, tile_cols;
+ int flags, size;
+
+ if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL)) {
+ av_log(c->fc, AV_LOG_INFO, "grid box with non seekable input\n");
+ return AVERROR_PATCHWELCOME;
+ }
+ if (item->is_idat_relative) {
+ if (!c->idat_offset) {
+ av_log(c->fc, AV_LOG_ERROR, "missing idat box required by the image grid\n");
+ return AVERROR_INVALIDDATA;
+ }
+ offset = c->idat_offset;
+ }
+
+ avio_seek(s->pb, item->extent_offset + offset, SEEK_SET);
+
+ avio_r8(s->pb); /* version */
+ flags = avio_r8(s->pb);
+
+ tile_rows = avio_r8(s->pb) + 1;
+ tile_cols = avio_r8(s->pb) + 1;
+ /* actual width and height of output image */
+ tile_grid->width = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb);
+ tile_grid->height = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb);
+
+ av_log(c->fc, AV_LOG_TRACE, "grid: grid_rows %d grid_cols %d output_width %d output_height %d\n",
+ tile_rows, tile_cols, tile_grid->width, tile_grid->height);
+
+ avio_seek(s->pb, pos, SEEK_SET);
+
+ size = tile_rows * tile_cols;
+ tile_grid->nb_tiles = grid->nb_tiles;
+
+ if (tile_grid->nb_tiles != size)
+ return AVERROR_INVALIDDATA;
+
+ for (int i = 0; i < tile_cols; i++)
+ tile_grid->coded_width += grid->tile_item_list[i]->width;
+ for (int i = 0; i < size; i += tile_cols)
+ tile_grid->coded_height += grid->tile_item_list[i]->height;
+
+ tile_grid->offsets = av_calloc(tile_grid->nb_tiles, sizeof(*tile_grid->offsets));
+ if (!tile_grid->offsets)
+ return AVERROR(ENOMEM);
+
+ while (y < tile_grid->coded_height) {
+ int left_col = i;
+
+ while (x < tile_grid->coded_width) {
+ if (i == tile_grid->nb_tiles)
+ return AVERROR_INVALIDDATA;
+
+ tile_grid->offsets[i].horizontal = x;
+ tile_grid->offsets[i].vertical = y;
+
+ x += grid->tile_item_list[i++]->width;
+ }
+
+ if (x > tile_grid->coded_width) {
+ av_log(c->fc, AV_LOG_ERROR, "Non uniform HEIF tiles\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ x = 0;
+ y += grid->tile_item_list[left_col]->height;
+ }
+
+ if (y > tile_grid->coded_height || i != tile_grid->nb_tiles) {
+ av_log(c->fc, AV_LOG_ERROR, "Non uniform HEIF tiles\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ return 0;
+}
+
+static int read_image_iovl(AVFormatContext *s, const HEIFGrid *grid,
+ AVStreamGroupTileGrid *tile_grid)
+{
+ MOVContext *c = s->priv_data;
+ const HEIFItem *item = grid->item;
+ uint16_t canvas_fill_value[4];
+ int64_t offset = 0, pos = avio_tell(s->pb);
+ int ret = 0, flags;
+
+ if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL)) {
+ av_log(c->fc, AV_LOG_INFO, "iovl box with non seekable input\n");
+ return AVERROR_PATCHWELCOME;
+ }
+ if (item->is_idat_relative) {
+ if (!c->idat_offset) {
+ av_log(c->fc, AV_LOG_ERROR, "missing idat box required by the image overlay\n");
+ return AVERROR_INVALIDDATA;
+ }
+ offset = c->idat_offset;
+ }
+
+ avio_seek(s->pb, item->extent_offset + offset, SEEK_SET);
+
+ avio_r8(s->pb); /* version */
+ flags = avio_r8(s->pb);
+
+ for (int i = 0; i < 4; i++)
+ canvas_fill_value[i] = avio_rb16(s->pb);
+ av_log(c->fc, AV_LOG_TRACE, "iovl: canvas_fill_value { %u, %u, %u, %u }\n",
+ canvas_fill_value[0], canvas_fill_value[1],
+ canvas_fill_value[2], canvas_fill_value[3]);
+ for (int i = 0; i < 4; i++)
+ tile_grid->background[i] = canvas_fill_value[i];
+
+ /* actual width and height of output image */
+ tile_grid->width =
+ tile_grid->coded_width = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb);
+ tile_grid->height =
+ tile_grid->coded_height = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb);
+ av_log(c->fc, AV_LOG_TRACE, "iovl: output_width %d, output_height %d\n",
+ tile_grid->width, tile_grid->height);
+
+ tile_grid->nb_tiles = grid->nb_tiles;
+ tile_grid->offsets = av_malloc_array(tile_grid->nb_tiles, sizeof(*tile_grid->offsets));
+ if (!tile_grid->offsets) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ for (int i = 0; i < tile_grid->nb_tiles; i++) {
+ tile_grid->offsets[i].idx = grid->tile_item_list[i]->st->index;
+ tile_grid->offsets[i].horizontal = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb);
+ tile_grid->offsets[i].vertical = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb);
+ av_log(c->fc, AV_LOG_TRACE, "iovl: stream_idx[%d] %u, "
+ "horizontal_offset[%d] %d, vertical_offset[%d] %d\n",
+ i, tile_grid->offsets[i].idx,
+ i, tile_grid->offsets[i].horizontal, i, tile_grid->offsets[i].vertical);
+ }
+
+fail:
+ avio_seek(s->pb, pos, SEEK_SET);
+
+ return ret;
+}
+
+static int mov_parse_tiles(AVFormatContext *s)
+{
+ MOVContext *mov = s->priv_data;
+
+ for (int i = 0; i < mov->nb_heif_grid; i++) {
+ AVStreamGroup *stg = avformat_stream_group_create(s, AV_STREAM_GROUP_PARAMS_TILE_GRID, NULL);
+ AVStreamGroupTileGrid *tile_grid;
+ const HEIFGrid *grid = &mov->heif_grid[i];
+ int err, loop = 1;
+
+ if (!stg)
+ return AVERROR(ENOMEM);
+
+ stg->id = grid->item->item_id;
+ tile_grid = stg->params.tile_grid;
+
+ for (int j = 0; j < grid->nb_tiles; j++) {
+ int tile_id = grid->tile_id_list[j];
+
+ for (int k = 0; k < mov->nb_heif_item; k++) {
+ HEIFItem *item = &mov->heif_item[k];
+ AVStream *st = item->st;
+
+ if (item->item_id != tile_id)
+ continue;
+ if (!st) {
+ av_log(s, AV_LOG_WARNING, "HEIF item id %d from grid id %d doesn't "
+ "reference a stream\n",
+ tile_id, grid->item->item_id);
+ ff_remove_stream_group(s, stg);
+ loop = 0;
+ break;
+ }
+
+ grid->tile_item_list[j] = item;
+
+ err = avformat_stream_group_add_stream(stg, st);
+ if (err < 0 && err != AVERROR(EEXIST))
+ return err;
+
+ st->disposition |= AV_DISPOSITION_DEPENDENT;
+ break;
+ }
+
+ if (!loop)
+ break;
+ }
+
+ if (!loop)
+ continue;
+
+ switch (grid->item->type) {
+ case MKTAG('g','r','i','d'):
+ err = read_image_grid(s, grid, tile_grid);
+ break;
+ case MKTAG('i','o','v','l'):
+ err = read_image_iovl(s, grid, tile_grid);
+ break;
+ default:
+ av_assert0(0);
+ }
+ if (err < 0)
+ return err;
+
+
+ if (grid->item->name)
+ av_dict_set(&stg->metadata, "title", grid->item->name, 0);
+ if (grid->item->item_id == mov->primary_item_id)
+ stg->disposition |= AV_DISPOSITION_DEFAULT;
+ }
+
+ return 0;
+}
+
static int mov_read_header(AVFormatContext *s)
{
MOVContext *mov = s->priv_data;
@@ -9109,6 +9490,8 @@ static int mov_read_header(AVFormatContext *s)
mov->fc = s;
mov->trak_index = -1;
+ mov->thmb_item_id = -1;
+ mov->primary_item_id = -1;
/* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */
if (pb->seekable & AVIO_SEEKABLE_NORMAL)
atom.size = avio_size(pb);
@@ -9135,19 +9518,42 @@ static int mov_read_header(AVFormatContext *s)
HEIFItem *item = &mov->heif_item[i];
MOVStreamContext *sc;
AVStream *st;
+ int64_t offset = 0;
- if (!item->st)
+ if (!item->st) {
+ if (item->item_id == mov->thmb_item_id) {
+ av_log(s, AV_LOG_ERROR, "HEIF thumbnail doesn't reference a stream\n");
+ return AVERROR_INVALIDDATA;
+ }
continue;
+ }
+ if (item->is_idat_relative) {
+ if (!mov->idat_offset) {
+ av_log(s, AV_LOG_ERROR, "Missing idat box for item %d\n", item->item_id);
+ return AVERROR_INVALIDDATA;
+ }
+ offset = mov->idat_offset;
+ }
st = item->st;
sc = st->priv_data;
st->codecpar->width = item->width;
st->codecpar->height = item->height;
+
sc->sample_sizes[0] = item->extent_length;
- sc->chunk_offsets[0] = item->extent_offset;
+ sc->chunk_offsets[0] = item->extent_offset + offset;
+
+ if (item->item_id == mov->primary_item_id)
+ st->disposition |= AV_DISPOSITION_DEFAULT;
mov_build_index(mov, st);
}
+
+ if (mov->nb_heif_grid) {
+ err = mov_parse_tiles(s);
+ if (err < 0)
+ return err;
+ }
}
if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
diff --git a/libavformat/version.h b/libavformat/version.h
index d8fc959f19..3fa8e04314 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
#include "version_major.h"
#define LIBAVFORMAT_VERSION_MINOR 22
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
1
0
ffmpeg | branch: master | James Almer <jamrial(a)gmail.com> | Mon Jan 22 14:35:33 2024 -0300| [25a10677d12c3c9def7cb22514662ac149c05fc6] | committer: James Almer
avformat: add a Tile Grid stream group type
This will be used to support tiled image formats like HEIF.
Signed-off-by: James Almer <jamrial(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=25a10677d12c3c9de…
---
doc/APIchanges | 5 ++
libavformat/avformat.c | 5 ++
libavformat/avformat.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++++
libavformat/dump.c | 30 +++++++++
libavformat/options.c | 34 +++++++++++
libavformat/version.h | 4 +-
6 files changed, 237 insertions(+), 2 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index d26110b285..d8b48e2915 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,11 @@ The last version increases of all libraries were on 2023-02-09
API changes, most recent first:
+2024-02-26 - xxxxxxxxxx - lavf 60.22.100 - avformat.h
+ Add AVStreamGroupTileGrid
+ Add AV_STREAM_GROUP_PARAMS_TILE_GRID
+ Add AVStreamGroup.params.tile_grid
+
2024-02-21 - xxxxxxxxxx - lavc 60.40.100 - avcodec.h
Deprecate AV_INPUT_BUFFER_MIN_SIZE without replacement.
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index ca31d3dc56..f53ba4ce58 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -99,6 +99,11 @@ void ff_free_stream_group(AVStreamGroup **pstg)
av_iamf_mix_presentation_free(&stg->params.iamf_mix_presentation);
break;
}
+ case AV_STREAM_GROUP_PARAMS_TILE_GRID:
+ av_opt_free(stg->params.tile_grid);
+ av_freep(&stg->params.tile_grid->offsets);
+ av_freep(&stg->params.tile_grid);
+ break;
default:
break;
}
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 50bbd1949b..c3de1fdafc 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1018,10 +1018,170 @@ typedef struct AVStream {
int pts_wrap_bits;
} AVStream;
+/**
+ * AVStreamGroupTileGrid holds information on how to combine several
+ * independent images on a single canvas for presentation.
+ *
+ * The output should be a @ref AVStreamGroupTileGrid.background "background"
+ * colored @ref AVStreamGroupTileGrid.coded_width "coded_width" x
+ * @ref AVStreamGroupTileGrid.coded_height "coded_height" canvas where a
+ * @ref AVStreamGroupTileGrid.nb_tiles "nb_tiles" amount of tiles are placed in
+ * the order they appear in the @ref AVStreamGroupTileGrid.offsets "offsets"
+ * array, at the exact offset described for them. In particular, if two or more
+ * tiles overlap, the image with higher index in the
+ * @ref AVStreamGroupTileGrid.offsets "offsets" array takes priority.
+ * Note that a single image may be used multiple times, i.e. multiple entries
+ * in @ref AVStreamGroupTileGrid.offsets "offsets" may have the same value of
+ * idx.
+ *
+ * The following is an example of a simple grid with 3 rows and 4 columns:
+ *
+ * +---+---+---+---+
+ * | 0 | 1 | 2 | 3 |
+ * +---+---+---+---+
+ * | 4 | 5 | 6 | 7 |
+ * +---+---+---+---+
+ * | 8 | 9 |10 |11 |
+ * +---+---+---+---+
+ *
+ * Assuming all tiles have a dimension of 512x512, the
+ * @ref AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of
+ * the first @ref AVStreamGroup.streams "stream" in the group is "0,0", the
+ * @ref AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of
+ * the second @ref AVStreamGroup.streams "stream" in the group is "512,0", the
+ * @ref AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of
+ * the fifth @ref AVStreamGroup.streams "stream" in the group is "0,512", the
+ * @ref AVStreamGroupTileGrid.offsets "offset", of the topleft pixel of
+ * the sixth @ref AVStreamGroup.streams "stream" in the group is "512,512",
+ * etc.
+ *
+ * The following is an example of a canvas with overlaping tiles:
+ *
+ * +-----------+
+ * | %%%%% |
+ * |***%%3%%@@@|
+ * |**0%%%%%2@@|
+ * |***##1@@@@@|
+ * | ##### |
+ * +-----------+
+ *
+ * Assuming a canvas with size 1024x1024 and all tiles with a dimension of
+ * 512x512, a possible @ref AVStreamGroupTileGrid.offsets "offset" for the
+ * topleft pixel of the first @ref AVStreamGroup.streams "stream" in the group
+ * would be 0x256, the @ref AVStreamGroupTileGrid.offsets "offset" for the
+ * topleft pixel of the second @ref AVStreamGroup.streams "stream" in the group
+ * would be 256x512, the @ref AVStreamGroupTileGrid.offsets "offset" for the
+ * topleft pixel of the third @ref AVStreamGroup.streams "stream" in the group
+ * would be 512x256, and the @ref AVStreamGroupTileGrid.offsets "offset" for
+ * the topleft pixel of the fourth @ref AVStreamGroup.streams "stream" in the
+ * group would be 256x0.
+ *
+ * sizeof(AVStreamGroupTileGrid) is not a part of the ABI and may only be
+ * allocated by avformat_stream_group_create().
+ */
+typedef struct AVStreamGroupTileGrid {
+ const AVClass *av_class;
+
+ /**
+ * Amount of tiles in the grid.
+ *
+ * Must be > 0.
+ */
+ unsigned int nb_tiles;
+
+ /**
+ * Width of the canvas.
+ *
+ * Must be > 0.
+ */
+ int coded_width;
+ /**
+ * Width of the canvas.
+ *
+ * Must be > 0.
+ */
+ int coded_height;
+
+ /**
+ * An @ref nb_tiles sized array of offsets in pixels from the topleft edge
+ * of the canvas, indicating where each stream should be placed.
+ * It must be allocated with the av_malloc() family of functions.
+ *
+ * - demuxing: set by libavformat, must not be modified by the caller.
+ * - muxing: set by the caller before avformat_write_header().
+ *
+ * Freed by libavformat in avformat_free_context().
+ */
+ struct {
+ /**
+ * Index of the stream in the group this tile references.
+ *
+ * Must be < @ref AVStreamGroup.nb_streams "nb_streams".
+ */
+ unsigned int idx;
+ /**
+ * Offset in pixels from the left edge of the canvas where the tile
+ * should be placed.
+ */
+ int horizontal;
+ /**
+ * Offset in pixels from the top edge of the canvas where the tile
+ * should be placed.
+ */
+ int vertical;
+ } *offsets;
+
+ /**
+ * The pixel value per channel in RGBA format used if no pixel of any tile
+ * is located at a particular pixel location.
+ *
+ * @see av_image_fill_color().
+ * @see av_parse_color().
+ */
+ uint8_t background[4];
+
+ /**
+ * Offset in pixels from the left edge of the canvas where the actual image
+ * meant for presentation starts.
+ *
+ * This field must be >= 0 and < @ref coded_width.
+ */
+ int horizontal_offset;
+ /**
+ * Offset in pixels from the top edge of the canvas where the actual image
+ * meant for presentation starts.
+ *
+ * This field must be >= 0 and < @ref coded_height.
+ */
+ int vertical_offset;
+
+ /**
+ * Width of the final image for presentation.
+ *
+ * Must be > 0 and <= (@ref coded_width - @ref horizontal_offset).
+ * When it's not equal to (@ref coded_width - @ref horizontal_offset), the
+ * result of (@ref coded_width - width - @ref horizontal_offset) is the
+ * amount amount of pixels to be cropped from the right edge of the
+ * final image before presentation.
+ */
+ int width;
+ /**
+ * Height of the final image for presentation.
+ *
+ * Must be > 0 and <= (@ref coded_height - @ref vertical_offset).
+ * When it's not equal to (@ref coded_height - @ref vertical_offset), the
+ * result of (@ref coded_height - height - @ref vertical_offset) is the
+ * amount amount of pixels to be cropped from the bottom edge of the
+ * final image before presentation.
+ */
+ int height;
+} AVStreamGroupTileGrid;
+
enum AVStreamGroupParamsType {
AV_STREAM_GROUP_PARAMS_NONE,
AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT,
AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION,
+ AV_STREAM_GROUP_PARAMS_TILE_GRID,
};
struct AVIAMFAudioElement;
@@ -1062,6 +1222,7 @@ typedef struct AVStreamGroup {
union {
struct AVIAMFAudioElement *iamf_audio_element;
struct AVIAMFMixPresentation *iamf_mix_presentation;
+ struct AVStreamGroupTileGrid *tile_grid;
} params;
/**
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 42b1909bd7..49be8deeca 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdint.h>
+#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/display.h"
#include "libavutil/iamf.h"
@@ -747,6 +748,35 @@ static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed,
}
break;
}
+ case AV_STREAM_GROUP_PARAMS_TILE_GRID: {
+ const AVStreamGroupTileGrid *tile_grid = stg->params.tile_grid;
+ AVCodecContext *avctx = avcodec_alloc_context3(NULL);
+ const char *ptr = NULL;
+ av_log(NULL, AV_LOG_INFO, " Tile Grid:");
+ if (avctx && stg->nb_streams && !avcodec_parameters_to_context(avctx, stg->streams[0]->codecpar)) {
+ avctx->width = tile_grid->width;
+ avctx->height = tile_grid->height;
+ avctx->coded_width = tile_grid->coded_width;
+ avctx->coded_height = tile_grid->coded_height;
+ if (ic->dump_separator)
+ av_opt_set(avctx, "dump_separator", ic->dump_separator, 0);
+ buf[0] = 0;
+ avcodec_string(buf, sizeof(buf), avctx, is_output);
+ ptr = av_stristr(buf, " ");
+ }
+ avcodec_free_context(&avctx);
+ if (ptr)
+ av_log(NULL, AV_LOG_INFO, "%s", ptr);
+ dump_disposition(stg->disposition, AV_LOG_INFO);
+ av_log(NULL, AV_LOG_INFO, "\n");
+ dump_metadata(NULL, stg->metadata, " ", AV_LOG_INFO);
+ for (int i = 0; i < stg->nb_streams; i++) {
+ const AVStream *st = stg->streams[i];
+ dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE);
+ printed[st->index] = 1;
+ }
+ break;
+ }
default:
break;
}
diff --git a/libavformat/options.c b/libavformat/options.c
index f54a3c97b5..cd7e4cea9c 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -341,6 +341,28 @@ fail:
return NULL;
}
+#define FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
+#define OFFSET(x) offsetof(AVStreamGroupTileGrid, x)
+static const AVOption tile_grid_options[] = {
+ { "grid_size", "size of the output canvas", OFFSET(coded_width),
+ AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
+ { "output_size", "size of valid pixels in output image meant for presentation", OFFSET(width),
+ AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
+ { "background_color", "set a background color for unused pixels",
+ OFFSET(background), AV_OPT_TYPE_COLOR, { .str = "black"}, 0, 0, FLAGS },
+ { "horizontal_offset", NULL, OFFSET(horizontal_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
+ { "vertical_offset", NULL, OFFSET(vertical_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
+ { NULL },
+};
+#undef FLAGS
+#undef OFFSET
+
+static const AVClass tile_grid_class = {
+ .class_name = "AVStreamGroupTileGrid",
+ .version = LIBAVUTIL_VERSION_INT,
+ .option = tile_grid_options,
+};
+
static void *stream_group_child_next(void *obj, void *prev)
{
AVStreamGroup *stg = obj;
@@ -350,6 +372,8 @@ static void *stream_group_child_next(void *obj, void *prev)
return stg->params.iamf_audio_element;
case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION:
return stg->params.iamf_mix_presentation;
+ case AV_STREAM_GROUP_PARAMS_TILE_GRID:
+ return stg->params.tile_grid;
default:
break;
}
@@ -372,6 +396,9 @@ static const AVClass *stream_group_child_iterate(void **opaque)
case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION:
ret = av_iamf_mix_presentation_get_class();
break;
+ case AV_STREAM_GROUP_PARAMS_TILE_GRID:
+ ret = &tile_grid_class;
+ break;
default:
break;
}
@@ -434,6 +461,13 @@ AVStreamGroup *avformat_stream_group_create(AVFormatContext *s,
if (!stg->params.iamf_mix_presentation)
goto fail;
break;
+ case AV_STREAM_GROUP_PARAMS_TILE_GRID:
+ stg->params.tile_grid = av_mallocz(sizeof(*stg->params.tile_grid));
+ if (!stg->params.tile_grid)
+ goto fail;
+ stg->params.tile_grid->av_class = &tile_grid_class;
+ av_opt_set_defaults(stg->params.tile_grid);
+ break;
default:
goto fail;
}
diff --git a/libavformat/version.h b/libavformat/version.h
index 2f54f57c02..d8fc959f19 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,8 +31,8 @@
#include "version_major.h"
-#define LIBAVFORMAT_VERSION_MINOR 21
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR 22
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
1
0