MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / downmix_required

Function downmix_required

libhb/decavcodec.c:159–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157#define HB_AV_CH_BOTH_MASK (HB_AV_CH_SIDE_MASK|HB_AV_CH_BACK_MASK)
158
159static int downmix_required(const AVChannelLayout *target_layout_mask, const AVChannelLayout *input_layout_mask)
160{
161 /*
162 * Side channels can easily be remapped to back channels and vice-versa.
163 * Provided the other channels are the same, downmixing is not required.
164 */
165 if (av_channel_layout_subset(input_layout_mask, HB_AV_CH_SIDE_MASK) == 0 &&
166 av_channel_layout_subset(input_layout_mask, HB_AV_CH_BACK_MASK) == HB_AV_CH_BACK_MASK)
167 {
168 if (av_channel_layout_subset(target_layout_mask, HB_AV_CH_BACK_MASK) == 0 &&
169 av_channel_layout_subset(target_layout_mask, HB_AV_CH_SIDE_MASK) == HB_AV_CH_SIDE_MASK)
170 {
171 // input has back channels but not side channels
172 // target has the opposite (sides but not backs)
173 return (av_channel_layout_subset(input_layout_mask, ~HB_AV_CH_BOTH_MASK) !=
174 av_channel_layout_subset(target_layout_mask, ~HB_AV_CH_BOTH_MASK));
175 }
176 }
177 if (av_channel_layout_subset(input_layout_mask, HB_AV_CH_BACK_MASK) == 0 &&
178 av_channel_layout_subset(input_layout_mask, HB_AV_CH_SIDE_MASK) == HB_AV_CH_SIDE_MASK)
179 {
180 if (av_channel_layout_subset(target_layout_mask, HB_AV_CH_SIDE_MASK) == 0 &&
181 av_channel_layout_subset(target_layout_mask, HB_AV_CH_BACK_MASK) == HB_AV_CH_BACK_MASK)
182 {
183 // input has side channels but not back channels
184 // target has the opposite (backs but not sides)
185 return (av_channel_layout_subset(input_layout_mask, ~HB_AV_CH_BOTH_MASK) !=
186 av_channel_layout_subset(target_layout_mask, ~HB_AV_CH_BOTH_MASK));
187 }
188 }
189 return av_channel_layout_compare(input_layout_mask, target_layout_mask);
190}
191
192static uint64_t ac3_downmix_mask(int hb_mixdown, int normalized, const AVChannelLayout *input_layout, const char **dmix_mode)
193{

Callers 2

ac3_downmix_maskFunction · 0.85
truehd_downmix_maskFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected