Re: [FFmpeg-devel] [PATCH 2/3 v2] avcodec/aacdec_template: add more checks to make sure only 22.2 gets to 22.2
On Sat, Aug 22, 2020 at 05:01:05PM +0300, Jan Ekström wrote: > On Sat, Aug 22, 2020 at 4:44 PM Michael Niedermayer > wrote: > > > > On Sat, Aug 22, 2020 at 02:36:09PM +0300, Jan Ekström wrote: > > > On Sat, Aug 22, 2020 at 2:17 PM Michael Niedermayer > > > wrote: > > > > > > > > On Sat, Aug 22, 2020 at 12:57:59AM +0300, Jan Ekström wrote: > > > > > This way we can check that we have exactly the required things for > > > > > 22.2. > > > > > > > > > > Fixes #8845 > > > > > --- > > > > > libavcodec/aacdec_template.c | 47 > > > > > ++-- > > > > > 1 file changed, 45 insertions(+), 2 deletions(-) > > > > > > > > > > diff --git a/libavcodec/aacdec_template.c > > > > > b/libavcodec/aacdec_template.c > > > > > index 9f7016790e..63604d39fd 100644 > > > > > --- a/libavcodec/aacdec_template.c > > > > > +++ b/libavcodec/aacdec_template.c > > > > > @@ -266,6 +266,7 @@ static int count_paired_channels(uint8_t > > > > > (*layout_map)[3], int tags, int pos, > > > > > return num_pos_channels; > > > > > } > > > > > > > > > > +#define PREFIX_FOR_22POINT2 > > > > > (AV_CH_LAYOUT_7POINT1_WIDE_BACK|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_LOW_FREQUENCY_2) > > > > > static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int > > > > > tags) > > > > > { > > > > > int i, n, total_non_cc_elements; > > > > > @@ -402,46 +403,86 @@ static uint64_t sniff_channel_order(uint8_t > > > > > (*layout_map)[3], int tags) > > > > > } > > > > > > > > > > // The previous checks would end up at 8 at this point for 22.2 > > > > > -if (tags == 16 && i == 8) { > > > > > +if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { > > > > > +if (layout_map[i][0] != TYPE_SCE || > > > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > > > +goto end_of_layout_definition; > > > > > + > > > > > e2c_vec[i] = (struct elem_to_channel) { > > > > > .av_position = AV_CH_TOP_FRONT_CENTER, > > > > > .syn_ele = layout_map[i][0], > > > > > .elem_id = layout_map[i][1], > > > > > .aac_position = layout_map[i][2] > > > > > }; layout |= e2c_vec[i].av_position; i++; > > > > > + > > > > > +if (layout_map[i][0] != TYPE_CPE || > > > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > > > +goto end_of_layout_definition; > > > > > + > > > > > i += assign_pair(e2c_vec, layout_map, i, > > > > > AV_CH_TOP_FRONT_LEFT, > > > > > AV_CH_TOP_FRONT_RIGHT, > > > > > AAC_CHANNEL_FRONT, > > > > > ); > > > > > + > > > > > +if (layout_map[i][0] != TYPE_CPE || > > > > > +layout_map[i][2] != AAC_CHANNEL_SIDE) > > > > > +goto end_of_layout_definition; > > > > > + > > > > > i += assign_pair(e2c_vec, layout_map, i, > > > > > AV_CH_TOP_SIDE_LEFT, > > > > > AV_CH_TOP_SIDE_RIGHT, > > > > > AAC_CHANNEL_SIDE, > > > > > ); > > > > > + > > > > > +if (layout_map[i][0] != TYPE_SCE || > > > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > > > +goto end_of_layout_definition; > > > > > + > > > > > e2c_vec[i] = (struct elem_to_channel) { > > > > > .av_position = AV_CH_TOP_CENTER, > > > > > .syn_ele = layout_map[i][0], > > > > > .elem_id = layout_map[i][1], > > > > > .aac_position = layout_map[i][2] > > > > > }; layout |= e2c_vec[i].av_position; i++; > > > > > + > > > > > +if (layout_map[i][0] != TYPE_CPE || > > > > > +layout_map[i][2] != AAC_CHANNEL_BACK) > > > > > +goto end_of_layout_definition; > > > > > + > > > > > i += assign_pair(e2c_vec, layout_map, i, > > > > > AV_CH_TOP_BACK_LEFT, > > > > > AV_CH_TOP_BACK_RIGHT, > > > > > AAC_CHANNEL_BACK, > > > > > ); > > > > > + > > > > > +if (layout_map[i][0] != TYPE_SCE || > > > > > +layout_map[i][2] != AAC_CHANNEL_BACK) > > > > > +goto end_of_layout_definition; > > > > > + > > > > > e2c_vec[i] = (struct elem_to_channel) { > > > > > .av_position = AV_CH_TOP_BACK_CENTER, > > > > > .syn_ele = layout_map[i][0], > > > > > .elem_id = layout_map[i][1], > > > > > .aac_position = layout_map[i][2] > > > > > }; layout |= e2c_vec[i].av_position; i++; > > > > > + > > > > > + > > > > > +if (layout_map[i][0] != TYPE_SCE || > > > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > > > +goto end_of_layout_definition; > > > > > + > > > > > e2c_vec[i] = (struct elem_to_channel) { > > > > >
Re: [FFmpeg-devel] [PATCH 2/3 v2] avcodec/aacdec_template: add more checks to make sure only 22.2 gets to 22.2
On Sat, Aug 22, 2020 at 4:44 PM Michael Niedermayer wrote: > > On Sat, Aug 22, 2020 at 02:36:09PM +0300, Jan Ekström wrote: > > On Sat, Aug 22, 2020 at 2:17 PM Michael Niedermayer > > wrote: > > > > > > On Sat, Aug 22, 2020 at 12:57:59AM +0300, Jan Ekström wrote: > > > > This way we can check that we have exactly the required things for 22.2. > > > > > > > > Fixes #8845 > > > > --- > > > > libavcodec/aacdec_template.c | 47 ++-- > > > > 1 file changed, 45 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c > > > > index 9f7016790e..63604d39fd 100644 > > > > --- a/libavcodec/aacdec_template.c > > > > +++ b/libavcodec/aacdec_template.c > > > > @@ -266,6 +266,7 @@ static int count_paired_channels(uint8_t > > > > (*layout_map)[3], int tags, int pos, > > > > return num_pos_channels; > > > > } > > > > > > > > +#define PREFIX_FOR_22POINT2 > > > > (AV_CH_LAYOUT_7POINT1_WIDE_BACK|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_LOW_FREQUENCY_2) > > > > static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) > > > > { > > > > int i, n, total_non_cc_elements; > > > > @@ -402,46 +403,86 @@ static uint64_t sniff_channel_order(uint8_t > > > > (*layout_map)[3], int tags) > > > > } > > > > > > > > // The previous checks would end up at 8 at this point for 22.2 > > > > -if (tags == 16 && i == 8) { > > > > +if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { > > > > +if (layout_map[i][0] != TYPE_SCE || > > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > > +goto end_of_layout_definition; > > > > + > > > > e2c_vec[i] = (struct elem_to_channel) { > > > > .av_position = AV_CH_TOP_FRONT_CENTER, > > > > .syn_ele = layout_map[i][0], > > > > .elem_id = layout_map[i][1], > > > > .aac_position = layout_map[i][2] > > > > }; layout |= e2c_vec[i].av_position; i++; > > > > + > > > > +if (layout_map[i][0] != TYPE_CPE || > > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > > +goto end_of_layout_definition; > > > > + > > > > i += assign_pair(e2c_vec, layout_map, i, > > > > AV_CH_TOP_FRONT_LEFT, > > > > AV_CH_TOP_FRONT_RIGHT, > > > > AAC_CHANNEL_FRONT, > > > > ); > > > > + > > > > +if (layout_map[i][0] != TYPE_CPE || > > > > +layout_map[i][2] != AAC_CHANNEL_SIDE) > > > > +goto end_of_layout_definition; > > > > + > > > > i += assign_pair(e2c_vec, layout_map, i, > > > > AV_CH_TOP_SIDE_LEFT, > > > > AV_CH_TOP_SIDE_RIGHT, > > > > AAC_CHANNEL_SIDE, > > > > ); > > > > + > > > > +if (layout_map[i][0] != TYPE_SCE || > > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > > +goto end_of_layout_definition; > > > > + > > > > e2c_vec[i] = (struct elem_to_channel) { > > > > .av_position = AV_CH_TOP_CENTER, > > > > .syn_ele = layout_map[i][0], > > > > .elem_id = layout_map[i][1], > > > > .aac_position = layout_map[i][2] > > > > }; layout |= e2c_vec[i].av_position; i++; > > > > + > > > > +if (layout_map[i][0] != TYPE_CPE || > > > > +layout_map[i][2] != AAC_CHANNEL_BACK) > > > > +goto end_of_layout_definition; > > > > + > > > > i += assign_pair(e2c_vec, layout_map, i, > > > > AV_CH_TOP_BACK_LEFT, > > > > AV_CH_TOP_BACK_RIGHT, > > > > AAC_CHANNEL_BACK, > > > > ); > > > > + > > > > +if (layout_map[i][0] != TYPE_SCE || > > > > +layout_map[i][2] != AAC_CHANNEL_BACK) > > > > +goto end_of_layout_definition; > > > > + > > > > e2c_vec[i] = (struct elem_to_channel) { > > > > .av_position = AV_CH_TOP_BACK_CENTER, > > > > .syn_ele = layout_map[i][0], > > > > .elem_id = layout_map[i][1], > > > > .aac_position = layout_map[i][2] > > > > }; layout |= e2c_vec[i].av_position; i++; > > > > + > > > > + > > > > +if (layout_map[i][0] != TYPE_SCE || > > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > > +goto end_of_layout_definition; > > > > + > > > > e2c_vec[i] = (struct elem_to_channel) { > > > > .av_position = AV_CH_BOTTOM_FRONT_CENTER, > > > > .syn_ele = layout_map[i][0], > > > > .elem_id = layout_map[i][1], > > > > .aac_position = layout_map[i][2] > > > > }; layout |= e2c_vec[i].av_position; i++; > > > > + > > > > +if
Re: [FFmpeg-devel] [PATCH 2/3 v2] avcodec/aacdec_template: add more checks to make sure only 22.2 gets to 22.2
On Sat, Aug 22, 2020 at 02:36:09PM +0300, Jan Ekström wrote: > On Sat, Aug 22, 2020 at 2:17 PM Michael Niedermayer > wrote: > > > > On Sat, Aug 22, 2020 at 12:57:59AM +0300, Jan Ekström wrote: > > > This way we can check that we have exactly the required things for 22.2. > > > > > > Fixes #8845 > > > --- > > > libavcodec/aacdec_template.c | 47 ++-- > > > 1 file changed, 45 insertions(+), 2 deletions(-) > > > > > > diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c > > > index 9f7016790e..63604d39fd 100644 > > > --- a/libavcodec/aacdec_template.c > > > +++ b/libavcodec/aacdec_template.c > > > @@ -266,6 +266,7 @@ static int count_paired_channels(uint8_t > > > (*layout_map)[3], int tags, int pos, > > > return num_pos_channels; > > > } > > > > > > +#define PREFIX_FOR_22POINT2 > > > (AV_CH_LAYOUT_7POINT1_WIDE_BACK|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_LOW_FREQUENCY_2) > > > static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) > > > { > > > int i, n, total_non_cc_elements; > > > @@ -402,46 +403,86 @@ static uint64_t sniff_channel_order(uint8_t > > > (*layout_map)[3], int tags) > > > } > > > > > > // The previous checks would end up at 8 at this point for 22.2 > > > -if (tags == 16 && i == 8) { > > > +if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { > > > +if (layout_map[i][0] != TYPE_SCE || > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > +goto end_of_layout_definition; > > > + > > > e2c_vec[i] = (struct elem_to_channel) { > > > .av_position = AV_CH_TOP_FRONT_CENTER, > > > .syn_ele = layout_map[i][0], > > > .elem_id = layout_map[i][1], > > > .aac_position = layout_map[i][2] > > > }; layout |= e2c_vec[i].av_position; i++; > > > + > > > +if (layout_map[i][0] != TYPE_CPE || > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > +goto end_of_layout_definition; > > > + > > > i += assign_pair(e2c_vec, layout_map, i, > > > AV_CH_TOP_FRONT_LEFT, > > > AV_CH_TOP_FRONT_RIGHT, > > > AAC_CHANNEL_FRONT, > > > ); > > > + > > > +if (layout_map[i][0] != TYPE_CPE || > > > +layout_map[i][2] != AAC_CHANNEL_SIDE) > > > +goto end_of_layout_definition; > > > + > > > i += assign_pair(e2c_vec, layout_map, i, > > > AV_CH_TOP_SIDE_LEFT, > > > AV_CH_TOP_SIDE_RIGHT, > > > AAC_CHANNEL_SIDE, > > > ); > > > + > > > +if (layout_map[i][0] != TYPE_SCE || > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > +goto end_of_layout_definition; > > > + > > > e2c_vec[i] = (struct elem_to_channel) { > > > .av_position = AV_CH_TOP_CENTER, > > > .syn_ele = layout_map[i][0], > > > .elem_id = layout_map[i][1], > > > .aac_position = layout_map[i][2] > > > }; layout |= e2c_vec[i].av_position; i++; > > > + > > > +if (layout_map[i][0] != TYPE_CPE || > > > +layout_map[i][2] != AAC_CHANNEL_BACK) > > > +goto end_of_layout_definition; > > > + > > > i += assign_pair(e2c_vec, layout_map, i, > > > AV_CH_TOP_BACK_LEFT, > > > AV_CH_TOP_BACK_RIGHT, > > > AAC_CHANNEL_BACK, > > > ); > > > + > > > +if (layout_map[i][0] != TYPE_SCE || > > > +layout_map[i][2] != AAC_CHANNEL_BACK) > > > +goto end_of_layout_definition; > > > + > > > e2c_vec[i] = (struct elem_to_channel) { > > > .av_position = AV_CH_TOP_BACK_CENTER, > > > .syn_ele = layout_map[i][0], > > > .elem_id = layout_map[i][1], > > > .aac_position = layout_map[i][2] > > > }; layout |= e2c_vec[i].av_position; i++; > > > + > > > + > > > +if (layout_map[i][0] != TYPE_SCE || > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > +goto end_of_layout_definition; > > > + > > > e2c_vec[i] = (struct elem_to_channel) { > > > .av_position = AV_CH_BOTTOM_FRONT_CENTER, > > > .syn_ele = layout_map[i][0], > > > .elem_id = layout_map[i][1], > > > .aac_position = layout_map[i][2] > > > }; layout |= e2c_vec[i].av_position; i++; > > > + > > > +if (layout_map[i][0] != TYPE_CPE || > > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > > +goto end_of_layout_definition; > > > + > > > i += assign_pair(e2c_vec, layout_map, i, > > > AV_CH_BOTTOM_FRONT_LEFT, > > >
Re: [FFmpeg-devel] [PATCH 2/3 v2] avcodec/aacdec_template: add more checks to make sure only 22.2 gets to 22.2
On Sat, Aug 22, 2020 at 2:17 PM Michael Niedermayer wrote: > > On Sat, Aug 22, 2020 at 12:57:59AM +0300, Jan Ekström wrote: > > This way we can check that we have exactly the required things for 22.2. > > > > Fixes #8845 > > --- > > libavcodec/aacdec_template.c | 47 ++-- > > 1 file changed, 45 insertions(+), 2 deletions(-) > > > > diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c > > index 9f7016790e..63604d39fd 100644 > > --- a/libavcodec/aacdec_template.c > > +++ b/libavcodec/aacdec_template.c > > @@ -266,6 +266,7 @@ static int count_paired_channels(uint8_t > > (*layout_map)[3], int tags, int pos, > > return num_pos_channels; > > } > > > > +#define PREFIX_FOR_22POINT2 > > (AV_CH_LAYOUT_7POINT1_WIDE_BACK|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_LOW_FREQUENCY_2) > > static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) > > { > > int i, n, total_non_cc_elements; > > @@ -402,46 +403,86 @@ static uint64_t sniff_channel_order(uint8_t > > (*layout_map)[3], int tags) > > } > > > > // The previous checks would end up at 8 at this point for 22.2 > > -if (tags == 16 && i == 8) { > > +if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { > > +if (layout_map[i][0] != TYPE_SCE || > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > +goto end_of_layout_definition; > > + > > e2c_vec[i] = (struct elem_to_channel) { > > .av_position = AV_CH_TOP_FRONT_CENTER, > > .syn_ele = layout_map[i][0], > > .elem_id = layout_map[i][1], > > .aac_position = layout_map[i][2] > > }; layout |= e2c_vec[i].av_position; i++; > > + > > +if (layout_map[i][0] != TYPE_CPE || > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > +goto end_of_layout_definition; > > + > > i += assign_pair(e2c_vec, layout_map, i, > > AV_CH_TOP_FRONT_LEFT, > > AV_CH_TOP_FRONT_RIGHT, > > AAC_CHANNEL_FRONT, > > ); > > + > > +if (layout_map[i][0] != TYPE_CPE || > > +layout_map[i][2] != AAC_CHANNEL_SIDE) > > +goto end_of_layout_definition; > > + > > i += assign_pair(e2c_vec, layout_map, i, > > AV_CH_TOP_SIDE_LEFT, > > AV_CH_TOP_SIDE_RIGHT, > > AAC_CHANNEL_SIDE, > > ); > > + > > +if (layout_map[i][0] != TYPE_SCE || > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > +goto end_of_layout_definition; > > + > > e2c_vec[i] = (struct elem_to_channel) { > > .av_position = AV_CH_TOP_CENTER, > > .syn_ele = layout_map[i][0], > > .elem_id = layout_map[i][1], > > .aac_position = layout_map[i][2] > > }; layout |= e2c_vec[i].av_position; i++; > > + > > +if (layout_map[i][0] != TYPE_CPE || > > +layout_map[i][2] != AAC_CHANNEL_BACK) > > +goto end_of_layout_definition; > > + > > i += assign_pair(e2c_vec, layout_map, i, > > AV_CH_TOP_BACK_LEFT, > > AV_CH_TOP_BACK_RIGHT, > > AAC_CHANNEL_BACK, > > ); > > + > > +if (layout_map[i][0] != TYPE_SCE || > > +layout_map[i][2] != AAC_CHANNEL_BACK) > > +goto end_of_layout_definition; > > + > > e2c_vec[i] = (struct elem_to_channel) { > > .av_position = AV_CH_TOP_BACK_CENTER, > > .syn_ele = layout_map[i][0], > > .elem_id = layout_map[i][1], > > .aac_position = layout_map[i][2] > > }; layout |= e2c_vec[i].av_position; i++; > > + > > + > > +if (layout_map[i][0] != TYPE_SCE || > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > +goto end_of_layout_definition; > > + > > e2c_vec[i] = (struct elem_to_channel) { > > .av_position = AV_CH_BOTTOM_FRONT_CENTER, > > .syn_ele = layout_map[i][0], > > .elem_id = layout_map[i][1], > > .aac_position = layout_map[i][2] > > }; layout |= e2c_vec[i].av_position; i++; > > + > > +if (layout_map[i][0] != TYPE_CPE || > > +layout_map[i][2] != AAC_CHANNEL_FRONT) > > +goto end_of_layout_definition; > > + > > i += assign_pair(e2c_vec, layout_map, i, > > AV_CH_BOTTOM_FRONT_LEFT, > > AV_CH_BOTTOM_FRONT_RIGHT, > > @@ -449,9 +490,11 @@ static uint64_t sniff_channel_order(uint8_t > > (*layout_map)[3], int tags) > > ); > > } > > > > +end_of_layout_definition: > > + > > total_non_cc_elements = n = i; > > Probably ok if you intend
Re: [FFmpeg-devel] [PATCH 2/3 v2] avcodec/aacdec_template: add more checks to make sure only 22.2 gets to 22.2
On Sat, Aug 22, 2020 at 12:57:59AM +0300, Jan Ekström wrote: > This way we can check that we have exactly the required things for 22.2. > > Fixes #8845 > --- > libavcodec/aacdec_template.c | 47 ++-- > 1 file changed, 45 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c > index 9f7016790e..63604d39fd 100644 > --- a/libavcodec/aacdec_template.c > +++ b/libavcodec/aacdec_template.c > @@ -266,6 +266,7 @@ static int count_paired_channels(uint8_t > (*layout_map)[3], int tags, int pos, > return num_pos_channels; > } > > +#define PREFIX_FOR_22POINT2 > (AV_CH_LAYOUT_7POINT1_WIDE_BACK|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_LOW_FREQUENCY_2) > static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) > { > int i, n, total_non_cc_elements; > @@ -402,46 +403,86 @@ static uint64_t sniff_channel_order(uint8_t > (*layout_map)[3], int tags) > } > > // The previous checks would end up at 8 at this point for 22.2 > -if (tags == 16 && i == 8) { > +if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { > +if (layout_map[i][0] != TYPE_SCE || > +layout_map[i][2] != AAC_CHANNEL_FRONT) > +goto end_of_layout_definition; > + > e2c_vec[i] = (struct elem_to_channel) { > .av_position = AV_CH_TOP_FRONT_CENTER, > .syn_ele = layout_map[i][0], > .elem_id = layout_map[i][1], > .aac_position = layout_map[i][2] > }; layout |= e2c_vec[i].av_position; i++; > + > +if (layout_map[i][0] != TYPE_CPE || > +layout_map[i][2] != AAC_CHANNEL_FRONT) > +goto end_of_layout_definition; > + > i += assign_pair(e2c_vec, layout_map, i, > AV_CH_TOP_FRONT_LEFT, > AV_CH_TOP_FRONT_RIGHT, > AAC_CHANNEL_FRONT, > ); > + > +if (layout_map[i][0] != TYPE_CPE || > +layout_map[i][2] != AAC_CHANNEL_SIDE) > +goto end_of_layout_definition; > + > i += assign_pair(e2c_vec, layout_map, i, > AV_CH_TOP_SIDE_LEFT, > AV_CH_TOP_SIDE_RIGHT, > AAC_CHANNEL_SIDE, > ); > + > +if (layout_map[i][0] != TYPE_SCE || > +layout_map[i][2] != AAC_CHANNEL_FRONT) > +goto end_of_layout_definition; > + > e2c_vec[i] = (struct elem_to_channel) { > .av_position = AV_CH_TOP_CENTER, > .syn_ele = layout_map[i][0], > .elem_id = layout_map[i][1], > .aac_position = layout_map[i][2] > }; layout |= e2c_vec[i].av_position; i++; > + > +if (layout_map[i][0] != TYPE_CPE || > +layout_map[i][2] != AAC_CHANNEL_BACK) > +goto end_of_layout_definition; > + > i += assign_pair(e2c_vec, layout_map, i, > AV_CH_TOP_BACK_LEFT, > AV_CH_TOP_BACK_RIGHT, > AAC_CHANNEL_BACK, > ); > + > +if (layout_map[i][0] != TYPE_SCE || > +layout_map[i][2] != AAC_CHANNEL_BACK) > +goto end_of_layout_definition; > + > e2c_vec[i] = (struct elem_to_channel) { > .av_position = AV_CH_TOP_BACK_CENTER, > .syn_ele = layout_map[i][0], > .elem_id = layout_map[i][1], > .aac_position = layout_map[i][2] > }; layout |= e2c_vec[i].av_position; i++; > + > + > +if (layout_map[i][0] != TYPE_SCE || > +layout_map[i][2] != AAC_CHANNEL_FRONT) > +goto end_of_layout_definition; > + > e2c_vec[i] = (struct elem_to_channel) { > .av_position = AV_CH_BOTTOM_FRONT_CENTER, > .syn_ele = layout_map[i][0], > .elem_id = layout_map[i][1], > .aac_position = layout_map[i][2] > }; layout |= e2c_vec[i].av_position; i++; > + > +if (layout_map[i][0] != TYPE_CPE || > +layout_map[i][2] != AAC_CHANNEL_FRONT) > +goto end_of_layout_definition; > + > i += assign_pair(e2c_vec, layout_map, i, > AV_CH_BOTTOM_FRONT_LEFT, > AV_CH_BOTTOM_FRONT_RIGHT, > @@ -449,9 +490,11 @@ static uint64_t sniff_channel_order(uint8_t > (*layout_map)[3], int tags) > ); > } > > +end_of_layout_definition: > + > total_non_cc_elements = n = i; Probably ok if you intend for partial matches to be accepted partially, because i think this would accept whatever comes before a mismatch but not after, but maybe iam missing something thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If the United States is serious about
[FFmpeg-devel] [PATCH 2/3 v2] avcodec/aacdec_template: add more checks to make sure only 22.2 gets to 22.2
This way we can check that we have exactly the required things for 22.2. Fixes #8845 --- libavcodec/aacdec_template.c | 47 ++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 9f7016790e..63604d39fd 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -266,6 +266,7 @@ static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos, return num_pos_channels; } +#define PREFIX_FOR_22POINT2 (AV_CH_LAYOUT_7POINT1_WIDE_BACK|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_LOW_FREQUENCY_2) static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) { int i, n, total_non_cc_elements; @@ -402,46 +403,86 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) } // The previous checks would end up at 8 at this point for 22.2 -if (tags == 16 && i == 8) { +if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { +if (layout_map[i][0] != TYPE_SCE || +layout_map[i][2] != AAC_CHANNEL_FRONT) +goto end_of_layout_definition; + e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_TOP_FRONT_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] }; layout |= e2c_vec[i].av_position; i++; + +if (layout_map[i][0] != TYPE_CPE || +layout_map[i][2] != AAC_CHANNEL_FRONT) +goto end_of_layout_definition; + i += assign_pair(e2c_vec, layout_map, i, AV_CH_TOP_FRONT_LEFT, AV_CH_TOP_FRONT_RIGHT, AAC_CHANNEL_FRONT, ); + +if (layout_map[i][0] != TYPE_CPE || +layout_map[i][2] != AAC_CHANNEL_SIDE) +goto end_of_layout_definition; + i += assign_pair(e2c_vec, layout_map, i, AV_CH_TOP_SIDE_LEFT, AV_CH_TOP_SIDE_RIGHT, AAC_CHANNEL_SIDE, ); + +if (layout_map[i][0] != TYPE_SCE || +layout_map[i][2] != AAC_CHANNEL_FRONT) +goto end_of_layout_definition; + e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_TOP_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] }; layout |= e2c_vec[i].av_position; i++; + +if (layout_map[i][0] != TYPE_CPE || +layout_map[i][2] != AAC_CHANNEL_BACK) +goto end_of_layout_definition; + i += assign_pair(e2c_vec, layout_map, i, AV_CH_TOP_BACK_LEFT, AV_CH_TOP_BACK_RIGHT, AAC_CHANNEL_BACK, ); + +if (layout_map[i][0] != TYPE_SCE || +layout_map[i][2] != AAC_CHANNEL_BACK) +goto end_of_layout_definition; + e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_TOP_BACK_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] }; layout |= e2c_vec[i].av_position; i++; + + +if (layout_map[i][0] != TYPE_SCE || +layout_map[i][2] != AAC_CHANNEL_FRONT) +goto end_of_layout_definition; + e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_BOTTOM_FRONT_CENTER, .syn_ele = layout_map[i][0], .elem_id = layout_map[i][1], .aac_position = layout_map[i][2] }; layout |= e2c_vec[i].av_position; i++; + +if (layout_map[i][0] != TYPE_CPE || +layout_map[i][2] != AAC_CHANNEL_FRONT) +goto end_of_layout_definition; + i += assign_pair(e2c_vec, layout_map, i, AV_CH_BOTTOM_FRONT_LEFT, AV_CH_BOTTOM_FRONT_RIGHT, @@ -449,9 +490,11 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) ); } +end_of_layout_definition: + total_non_cc_elements = n = i; -if (tags == 16 && total_non_cc_elements == 16) { +if (layout == AV_CH_LAYOUT_22POINT2) { // For 22.2 reorder the result as needed FFSWAP(struct elem_to_channel, e2c_vec[2], e2c_vec[0]); // FL & FR first (final), FC third FFSWAP(struct elem_to_channel, e2c_vec[2], e2c_vec[1]); // FC second (final), FLc & FRc third -- 2.26.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject