* Decode a channel_pair_element; reference: table 4.4. * * @param elem_id Identifies the instance of a syntax element. * * @return Returns error status. 0 - OK, !0 - error */
| 1458 | * @return Returns error status. 0 - OK, !0 - error |
| 1459 | */ |
| 1460 | static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe) |
| 1461 | { |
| 1462 | int i, ret, common_window, ms_present = 0; |
| 1463 | |
| 1464 | common_window = get_bits1(gb); |
| 1465 | if (common_window) { |
| 1466 | if (decode_ics_info(ac, &cpe->ch[0].ics, gb, 1)) |
| 1467 | return -1; |
| 1468 | i = cpe->ch[1].ics.use_kb_window[0]; |
| 1469 | cpe->ch[1].ics = cpe->ch[0].ics; |
| 1470 | cpe->ch[1].ics.use_kb_window[1] = i; |
| 1471 | ms_present = get_bits(gb, 2); |
| 1472 | if (ms_present == 3) { |
| 1473 | av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n"); |
| 1474 | return -1; |
| 1475 | } else if (ms_present) |
| 1476 | decode_mid_side_stereo(cpe, gb, ms_present); |
| 1477 | } |
| 1478 | if ((ret = decode_ics(ac, &cpe->ch[0], gb, common_window, 0))) |
| 1479 | return ret; |
| 1480 | if ((ret = decode_ics(ac, &cpe->ch[1], gb, common_window, 0))) |
| 1481 | return ret; |
| 1482 | |
| 1483 | if (common_window) { |
| 1484 | if (ms_present) |
| 1485 | apply_mid_side_stereo(ac, cpe); |
| 1486 | if (ac->m4ac.object_type == AOT_AAC_MAIN) { |
| 1487 | apply_prediction(ac, &cpe->ch[0]); |
| 1488 | apply_prediction(ac, &cpe->ch[1]); |
| 1489 | } |
| 1490 | } |
| 1491 | |
| 1492 | apply_intensity_stereo(cpe, ms_present); |
| 1493 | return 0; |
| 1494 | } |
| 1495 | |
| 1496 | /** |
| 1497 | * Decode coupling_channel_element; reference: table 4.8. |
no test coverage detected