MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / read_channel_data

Function read_channel_data

libavcodec/alsdec.c:1123–1165  ·  view source on GitHub ↗

Reads the channel data. */

Source from the content-addressed store, hash-verified

1121/** Reads the channel data.
1122 */
1123static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c)
1124{
1125 GetBitContext *gb = &ctx->gb;
1126 ALSChannelData *current = cd;
1127 unsigned int channels = ctx->avctx->channels;
1128 int entries = 0;
1129
1130 while (entries < channels && !(current->stop_flag = get_bits1(gb))) {
1131 current->master_channel = get_bits_long(gb, av_ceil_log2(channels));
1132
1133 if (current->master_channel >= channels) {
1134 av_log(ctx->avctx, AV_LOG_ERROR, "Invalid master channel!\n");
1135 return -1;
1136 }
1137
1138 if (current->master_channel != c) {
1139 current->time_diff_flag = get_bits1(gb);
1140 current->weighting[0] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
1141 current->weighting[1] = mcc_weightings[av_clip(decode_rice(gb, 2) + 14, 0, 32)];
1142 current->weighting[2] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
1143
1144 if (current->time_diff_flag) {
1145 current->weighting[3] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
1146 current->weighting[4] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
1147 current->weighting[5] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
1148
1149 current->time_diff_sign = get_bits1(gb);
1150 current->time_diff_index = get_bits(gb, ctx->ltp_lag_length - 3) + 3;
1151 }
1152 }
1153
1154 current++;
1155 entries++;
1156 }
1157
1158 if (entries == channels) {
1159 av_log(ctx->avctx, AV_LOG_ERROR, "Damaged channel data!\n");
1160 return -1;
1161 }
1162
1163 align_get_bits(gb);
1164 return 0;
1165}
1166
1167
1168/** Recursively reverts the inter-channel correlation for a block.

Callers 1

read_frame_dataFunction · 0.85

Calls 8

get_bits1Function · 0.85
get_bits_longFunction · 0.85
av_ceil_log2Function · 0.85
av_logFunction · 0.85
av_clipFunction · 0.85
decode_riceFunction · 0.85
get_bitsFunction · 0.85
align_get_bitsFunction · 0.85

Tested by

no test coverage detected