35 #define FRONT_CENTER 2 36 #define LOW_FREQUENCY 3 39 #define FRONT_LEFT_OF_CENTER 6 40 #define FRONT_RIGHT_OF_CENTER 7 45 #define TOP_FRONT_LEFT 12 46 #define TOP_FRONT_CENTER 13 47 #define TOP_FRONT_RIGHT 14 48 #define TOP_BACK_LEFT 15 49 #define TOP_BACK_CENTER 16 50 #define TOP_BACK_RIGHT 17 51 #define STEREO_LEFT 29 52 #define STEREO_RIGHT 30 55 #define SURROUND_DIRECT_LEFT 33 56 #define SURROUND_DIRECT_RIGHT 34 57 #define LOW_FREQUENCY_2 35 59 #define SQRT3_2 1.22474487139158904909 63 return (!layout || (layout & (layout - 1)));
88 double center_mix_level,
double surround_mix_level,
90 double *matrix_out,
int stride,
93 int i, j, out_i, out_j;
94 double matrix[64][64] = {{0}};
97 int in_channels, out_channels;
103 unaccounted = in_layout & ~out_layout;
108 memset(matrix_out, 0, out_channels * stride *
sizeof(*matrix_out));
121 for (i = 0; i < 64; i++) {
122 if (in_layout & out_layout & (1ULL << i))
136 if (out_layout & AV_CH_FRONT_CENTER) {
140 if (in_layout & AV_CH_FRONT_CENTER)
156 if (unaccounted & (AV_CH_BACK_LEFT | AV_CH_SIDE_LEFT)) {
167 }
else if (out_layout & AV_CH_FRONT_CENTER) {
174 if (out_layout & AV_CH_BACK_CENTER) {
180 if (in_layout & AV_CH_SIDE_LEFT) {
202 }
else if (out_layout & AV_CH_FRONT_CENTER) {
210 if (out_layout & AV_CH_BACK_LEFT) {
213 if (in_layout & AV_CH_BACK_LEFT) {
220 }
else if (out_layout & AV_CH_BACK_CENTER) {
238 }
else if (out_layout & AV_CH_FRONT_CENTER) {
249 }
else if (out_layout & AV_CH_FRONT_CENTER) {
257 if (out_layout & AV_CH_FRONT_CENTER) {
268 for (out_i = i = 0; out_i < out_channels && i < 64; i++) {
270 for (out_j = j = 0; out_j < in_channels && j < 64; j++) {
271 matrix_out[out_i * stride + out_j] = matrix[
i][j];
272 sum += fabs(matrix[i][j]);
273 if (in_layout & (1ULL << j))
276 maxcoef =
FFMAX(maxcoef, sum);
277 if (out_layout & (1ULL << i))
282 if (normalize && maxcoef > 1.0) {
283 for (i = 0; i < out_channels; i++)
284 for (j = 0; j < in_channels; j++)
285 matrix_out[i * stride + j] /= maxcoef;
#define AV_CH_TOP_FRONT_RIGHT
#define AV_CH_LAYOUT_SURROUND
#define FRONT_RIGHT_OF_CENTER
#define AV_CH_TOP_FRONT_LEFT
#define AV_CH_SURROUND_DIRECT_RIGHT
#define AV_CH_LAYOUT_STEREO
#define AV_CH_TOP_BACK_LEFT
static int sane_layout(uint64_t layout)
#define AV_CH_LOW_FREQUENCY
int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout, double center_mix_level, double surround_mix_level, double lfe_mix_level, int normalize, double *matrix_out, int stride, enum AVMatrixEncoding matrix_encoding)
Generate a channel mixing matrix.
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
#define AV_CH_STEREO_RIGHT
See AV_CH_STEREO_LEFT.
#define AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_FRONT_LEFT_OF_CENTER
#define AV_CH_FRONT_CENTER
#define AV_CH_FRONT_RIGHT_OF_CENTER
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVRESAMPLE_MAX_CHANNELS
static av_always_inline int even(uint64_t layout)
Replacements for frequently missing libm functions.
#define AV_CH_TOP_BACK_RIGHT
synthesis window for stochastic i
#define FRONT_LEFT_OF_CENTER
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Buffer references ownership and permissions
#define AV_CH_BACK_CENTER
common internal and external API header
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
#define AV_CH_SURROUND_DIRECT_LEFT
#define AV_CH_FRONT_RIGHT
#define AV_CH_STEREO_LEFT
Stereo downmix.