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

Function read_frame_data

libavcodec/alsdec.c:1251–1375  ·  view source on GitHub ↗

Reads the frame data. */

Source from the content-addressed store, hash-verified

1249/** Reads the frame data.
1250 */
1251static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
1252{
1253 ALSSpecificConfig *sconf = &ctx->sconf;
1254 AVCodecContext *avctx = ctx->avctx;
1255 GetBitContext *gb = &ctx->gb;
1256 unsigned int div_blocks[32]; ///< block sizes.
1257 unsigned int c;
1258 unsigned int js_blocks[2];
1259
1260 uint32_t bs_info = 0;
1261
1262 // skip the size of the ra unit if present in the frame
1263 if (sconf->ra_flag == RA_FLAG_FRAMES && ra_frame)
1264 skip_bits_long(gb, 32);
1265
1266 if (sconf->mc_coding && sconf->joint_stereo) {
1267 ctx->js_switch = get_bits1(gb);
1268 align_get_bits(gb);
1269 }
1270
1271 if (!sconf->mc_coding || ctx->js_switch) {
1272 int independent_bs = !sconf->joint_stereo;
1273
1274 for (c = 0; c < avctx->channels; c++) {
1275 js_blocks[0] = 0;
1276 js_blocks[1] = 0;
1277
1278 get_block_sizes(ctx, div_blocks, &bs_info);
1279
1280 // if joint_stereo and block_switching is set, independent decoding
1281 // is signaled via the first bit of bs_info
1282 if (sconf->joint_stereo && sconf->block_switching)
1283 if (bs_info >> 31)
1284 independent_bs = 2;
1285
1286 // if this is the last channel, it has to be decoded independently
1287 if (c == avctx->channels - 1)
1288 independent_bs = 1;
1289
1290 if (independent_bs) {
1291 if (decode_blocks_ind(ctx, ra_frame, c, div_blocks, js_blocks))
1292 return -1;
1293
1294 independent_bs--;
1295 } else {
1296 if (decode_blocks(ctx, ra_frame, c, div_blocks, js_blocks))
1297 return -1;
1298
1299 c++;
1300 }
1301
1302 // store carryover raw samples
1303 memmove(ctx->raw_samples[c] - sconf->max_order,
1304 ctx->raw_samples[c] - sconf->max_order + sconf->frame_length,
1305 sizeof(*ctx->raw_samples[c]) * sconf->max_order);
1306 }
1307 } else { // multi-channel coding
1308 ALSBlockData bd;

Callers 1

decode_frameFunction · 0.85

Calls 11

skip_bits_longFunction · 0.85
get_bits1Function · 0.85
align_get_bitsFunction · 0.85
get_block_sizesFunction · 0.85
decode_blocks_indFunction · 0.85
av_logFunction · 0.85
read_blockFunction · 0.85
read_channel_dataFunction · 0.85
decode_blocksFunction · 0.70
decode_blockFunction · 0.70

Tested by

no test coverage detected