Decodes blocks dependently. */
| 1040 | /** Decodes blocks dependently. |
| 1041 | */ |
| 1042 | static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame, |
| 1043 | unsigned int c, const unsigned int *div_blocks, |
| 1044 | unsigned int *js_blocks) |
| 1045 | { |
| 1046 | ALSSpecificConfig *sconf = &ctx->sconf; |
| 1047 | unsigned int offset = 0; |
| 1048 | unsigned int b; |
| 1049 | ALSBlockData bd[2]; |
| 1050 | |
| 1051 | memset(bd, 0, 2 * sizeof(ALSBlockData)); |
| 1052 | |
| 1053 | bd[0].ra_block = ra_frame; |
| 1054 | bd[0].use_ltp = ctx->use_ltp; |
| 1055 | bd[0].ltp_lag = ctx->ltp_lag; |
| 1056 | bd[0].ltp_gain = ctx->ltp_gain[0]; |
| 1057 | bd[0].quant_cof = ctx->quant_cof[0]; |
| 1058 | bd[0].lpc_cof = ctx->lpc_cof[0]; |
| 1059 | bd[0].prev_raw_samples = ctx->prev_raw_samples; |
| 1060 | bd[0].js_blocks = *js_blocks; |
| 1061 | |
| 1062 | bd[1].ra_block = ra_frame; |
| 1063 | bd[1].use_ltp = ctx->use_ltp; |
| 1064 | bd[1].ltp_lag = ctx->ltp_lag; |
| 1065 | bd[1].ltp_gain = ctx->ltp_gain[0]; |
| 1066 | bd[1].quant_cof = ctx->quant_cof[0]; |
| 1067 | bd[1].lpc_cof = ctx->lpc_cof[0]; |
| 1068 | bd[1].prev_raw_samples = ctx->prev_raw_samples; |
| 1069 | bd[1].js_blocks = *(js_blocks + 1); |
| 1070 | |
| 1071 | // decode all blocks |
| 1072 | for (b = 0; b < ctx->num_blocks; b++) { |
| 1073 | unsigned int s; |
| 1074 | |
| 1075 | bd[0].shift_lsbs = 0; |
| 1076 | bd[1].shift_lsbs = 0; |
| 1077 | |
| 1078 | bd[0].block_length = div_blocks[b]; |
| 1079 | bd[1].block_length = div_blocks[b]; |
| 1080 | |
| 1081 | bd[0].raw_samples = ctx->raw_samples[c ] + offset; |
| 1082 | bd[1].raw_samples = ctx->raw_samples[c + 1] + offset; |
| 1083 | |
| 1084 | bd[0].raw_other = bd[1].raw_samples; |
| 1085 | bd[1].raw_other = bd[0].raw_samples; |
| 1086 | |
| 1087 | if(read_decode_block(ctx, &bd[0]) || read_decode_block(ctx, &bd[1])) { |
| 1088 | // damaged block, write zero for the rest of the frame |
| 1089 | zero_remaining(b, ctx->num_blocks, div_blocks, bd[0].raw_samples); |
| 1090 | zero_remaining(b, ctx->num_blocks, div_blocks, bd[1].raw_samples); |
| 1091 | return -1; |
| 1092 | } |
| 1093 | |
| 1094 | // reconstruct joint-stereo blocks |
| 1095 | if (bd[0].js_blocks) { |
| 1096 | if (bd[1].js_blocks) |
| 1097 | av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel pair!\n"); |
| 1098 | |
| 1099 | for (s = 0; s < div_blocks[b]; s++) |
no test coverage detected