Required for USAC
Unified · Split
| @@ -1113,10 +1113,12 @@ static av_cold int decode_close(AVCodecContext *avctx) · 1112 unmodified lines | ||
| 1113 | 1113 | } |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | + av_tx_uninit(&ac->mdct96); | |
| 1116 | 1117 | av_tx_uninit(&ac->mdct120); |
| 1117 | 1118 | av_tx_uninit(&ac->mdct128); |
| 1118 | 1119 | av_tx_uninit(&ac->mdct480); |
| 1119 | 1120 | av_tx_uninit(&ac->mdct512); |
| 1121 | + av_tx_uninit(&ac->mdct768); | |
| 1120 | 1122 | av_tx_uninit(&ac->mdct960); |
| 1121 | 1123 | av_tx_uninit(&ac->mdct1024); |
| 1122 | 1124 | av_tx_uninit(&ac->mdct_ltp); |
| @@ -1145,10 +1147,12 @@ static av_cold int init_dsp(AVCodecContext *avctx) · 22 unmodified lines | ||
| 1145 | 1147 | if (ret < 0) \ |
| 1146 | 1148 | return ret |
| 1147 | 1149 | |
| 1150 | + MDCT_INIT(ac->mdct96, ac->mdct96_fn, 96, 1.0/96); | |
| 1148 | 1151 | MDCT_INIT(ac->mdct120, ac->mdct120_fn, 120, 1.0/120); |
| 1149 | 1152 | MDCT_INIT(ac->mdct128, ac->mdct128_fn, 128, 1.0/128); |
| 1150 | 1153 | MDCT_INIT(ac->mdct480, ac->mdct480_fn, 480, 1.0/480); |
| 1151 | 1154 | MDCT_INIT(ac->mdct512, ac->mdct512_fn, 512, 1.0/512); |
| 1155 | + MDCT_INIT(ac->mdct768, ac->mdct768_fn, 768, 1.0/768); | |
| 1152 | 1156 | MDCT_INIT(ac->mdct960, ac->mdct960_fn, 960, 1.0/960); |
| 1153 | 1157 | MDCT_INIT(ac->mdct1024, ac->mdct1024_fn, 1024, 1.0/1024); |
| 1154 | 1158 | #undef MDCT_INIT |
| @@ -245,6 +245,7 @@ typedef struct AACDecDSP { · 244 unmodified lines | ||
| 245 | 245 | ChannelElement *cce, int index); |
| 246 | 246 | |
| 247 | 247 | void (*imdct_and_windowing)(AACDecContext *ac, SingleChannelElement *sce); |
| 248 | + void (*imdct_and_windowing_768)(AACDecContext *ac, SingleChannelElement *sce); | |
| 248 | 249 | void (*imdct_and_windowing_960)(AACDecContext *ac, SingleChannelElement *sce); |
| 249 | 250 | void (*imdct_and_windowing_ld)(AACDecContext *ac, SingleChannelElement *sce); |
| 250 | 251 | void (*imdct_and_windowing_eld)(AACDecContext *ac, SingleChannelElement *sce); |
| @@ -290,18 +291,22 @@ struct AACDecContext { · 39 unmodified lines | ||
| 290 | 291 | * @name Computed / set up during initialization |
| 291 | 292 | * @{ |
| 292 | 293 | */ |
| 294 | + AVTXContext *mdct96; | |
| 293 | 295 | AVTXContext *mdct120; |
| 294 | 296 | AVTXContext *mdct128; |
| 295 | 297 | AVTXContext *mdct480; |
| 296 | 298 | AVTXContext *mdct512; |
| 299 | + AVTXContext *mdct768; | |
| 297 | 300 | AVTXContext *mdct960; |
| 298 | 301 | AVTXContext *mdct1024; |
| 299 | 302 | AVTXContext *mdct_ltp; |
| 300 | 303 | |
| 304 | + av_tx_fn mdct96_fn; | |
| 301 | 305 | av_tx_fn mdct120_fn; |
| 302 | 306 | av_tx_fn mdct128_fn; |
| 303 | 307 | av_tx_fn mdct480_fn; |
| 304 | 308 | av_tx_fn mdct512_fn; |
| 309 | + av_tx_fn mdct768_fn; | |
| 305 | 310 | av_tx_fn mdct960_fn; |
| 306 | 311 | av_tx_fn mdct1024_fn; |
| 307 | 312 | av_tx_fn mdct_ltp_fn; |
| @@ -383,6 +383,71 @@ static void AAC_RENAME(imdct_and_windowing)(AACDecContext *ac, SingleChannelElem · 382 unmodified lines | ||
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | +/** | |
| 387 | + * Conduct IMDCT and windowing for 768-point frames. | |
| 388 | + */ | |
| 389 | +static void AAC_RENAME(imdct_and_windowing_768)(AACDecContext *ac, SingleChannelElement *sce) | |
| 390 | +{ | |
| 391 | + IndividualChannelStream *ics = &sce->ics; | |
| 392 | + INTFLOAT *in = sce->AAC_RENAME(coeffs); | |
| 393 | + INTFLOAT *out = sce->AAC_RENAME(output); | |
| 394 | + INTFLOAT *saved = sce->AAC_RENAME(saved); | |
| 395 | + const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME(aac_kbd_short_96) : AAC_RENAME(sine_96); | |
| 396 | + const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME(aac_kbd_long_768) : AAC_RENAME(sine_768); | |
| 397 | + const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME(aac_kbd_short_96) : AAC_RENAME(sine_96); | |
| 398 | + INTFLOAT *buf = ac->AAC_RENAME(buf_mdct); | |
| 399 | + INTFLOAT *temp = ac->AAC_RENAME(temp); | |
| 400 | + int i; | |
| 401 | + | |
| 402 | + // imdct | |
| 403 | + if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { | |
| 404 | + for (i = 0; i < 8; i++) | |
| 405 | + ac->mdct96_fn(ac->mdct96, buf + i * 96, in + i * 96, sizeof(INTFLOAT)); | |
| 406 | + } else { | |
| 407 | + ac->mdct768_fn(ac->mdct768, buf, in, sizeof(INTFLOAT)); | |
| 408 | + } | |
| 409 | + | |
| 410 | + /* window overlapping | |
| 411 | + * NOTE: To simplify the overlapping code, all 'meaningless' short to long | |
| 412 | + * and long to short transitions are considered to be short to short | |
| 413 | + * transitions. This leaves just two cases (long to long and short to short) | |
| 414 | + * with a little special sauce for EIGHT_SHORT_SEQUENCE. | |
| 415 | + */ | |
| 416 | + | |
| 417 | + if ((ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) && | |
| 418 | + (ics->window_sequence[0] == ONLY_LONG_SEQUENCE || ics->window_sequence[0] == LONG_START_SEQUENCE)) { | |
| 419 | + ac->fdsp->vector_fmul_window( out, saved, buf, lwindow_prev, 384); | |
| 420 | + } else { | |
| 421 | + memcpy( out, saved, 336 * sizeof(*out)); | |
| 422 | + | |
| 423 | + if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { | |
| 424 | + ac->fdsp->vector_fmul_window(out + 336 + 0*96, saved + 336, buf + 0*96, swindow_prev, 48); | |
| 425 | + ac->fdsp->vector_fmul_window(out + 336 + 1*96, buf + 0*96 + 48, buf + 1*96, swindow, 48); | |
| 426 | + ac->fdsp->vector_fmul_window(out + 336 + 2*96, buf + 1*96 + 48, buf + 2*96, swindow, 48); | |
| 427 | + ac->fdsp->vector_fmul_window(out + 336 + 3*96, buf + 2*96 + 48, buf + 3*96, swindow, 48); | |
| 428 | + ac->fdsp->vector_fmul_window(temp, buf + 3*96 + 48, buf + 4*96, swindow, 48); | |
| 429 | + memcpy( out + 336 + 4*96, temp, 48 * sizeof(*out)); | |
| 430 | + } else { | |
| 431 | + ac->fdsp->vector_fmul_window(out + 336, saved + 336, buf, swindow_prev, 48); | |
| 432 | + memcpy( out + 432, buf + 48, 336 * sizeof(*out)); | |
| 433 | + } | |
| 434 | + } | |
| 435 | + | |
| 436 | + // buffer update | |
| 437 | + if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { | |
| 438 | + memcpy( saved, temp + 48, 48 * sizeof(*saved)); | |
| 439 | + ac->fdsp->vector_fmul_window(saved + 48, buf + 4*96 + 48, buf + 5*96, swindow, 48); | |
| 440 | + ac->fdsp->vector_fmul_window(saved + 144, buf + 5*96 + 48, buf + 6*96, swindow, 48); | |
| 441 | + ac->fdsp->vector_fmul_window(saved + 240, buf + 6*96 + 48, buf + 7*96, swindow, 48); | |
| 442 | + memcpy( saved + 336, buf + 7*96 + 48, 48 * sizeof(*saved)); | |
| 443 | + } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) { | |
| 444 | + memcpy( saved, buf + 384, 336 * sizeof(*saved)); | |
| 445 | + memcpy( saved + 336, buf + 7*96 + 48, 48 * sizeof(*saved)); | |
| 446 | + } else { // LONG_STOP or ONLY_LONG | |
| 447 | + memcpy( saved, buf + 384, 384 * sizeof(*saved)); | |
| 448 | + } | |
| 449 | +} | |
| 450 | + | |
| 386 | 451 | /** |
| 387 | 452 | * Conduct IMDCT and windowing. |
| 388 | 453 | */ |
| @@ -447,6 +512,7 @@ static void AAC_RENAME(imdct_and_windowing_960)(AACDecContext *ac, SingleChannel · 58 unmodified lines | ||
| 447 | 512 | memcpy( saved, buf + 480, 480 * sizeof(*saved)); |
| 448 | 513 | } |
| 449 | 514 | } |
| 515 | + | |
| 450 | 516 | static void AAC_RENAME(imdct_and_windowing_ld)(AACDecContext *ac, SingleChannelElement *sce) |
| 451 | 517 | { |
| 452 | 518 | IndividualChannelStream *ics = &sce->ics; |
| @@ -609,6 +675,7 @@ static av_cold void AAC_RENAME(aac_dsp_init)(AACDecDSP *aac_dsp) · 156 unmodified lines | ||
| 609 | 675 | SET(apply_prediction); |
| 610 | 676 | |
| 611 | 677 | SET(imdct_and_windowing); |
| 678 | + SET(imdct_and_windowing_768); | |
| 612 | 679 | SET(imdct_and_windowing_960); |
| 613 | 680 | SET(imdct_and_windowing_ld); |
| 614 | 681 | SET(imdct_and_windowing_eld); |
| @@ -47,6 +47,8 @@ DECLARE_ALIGNED(32, static int, aac_kbd_long_1024_fixed)[1024]; · 46 unmodified lines | ||
| 47 | 47 | DECLARE_ALIGNED(32, static int, aac_kbd_short_128_fixed)[128]; |
| 48 | 48 | DECLARE_ALIGNED(32, static int, aac_kbd_long_960_fixed)[960]; |
| 49 | 49 | DECLARE_ALIGNED(32, static int, aac_kbd_short_120_fixed)[120]; |
| 50 | +DECLARE_ALIGNED(32, static int, aac_kbd_long_768_fixed)[768]; | |
| 51 | +DECLARE_ALIGNED(32, static int, aac_kbd_short_96_fixed)[96]; | |
| 50 | 52 | |
| 51 | 53 | static void init_tables_fixed_fn(void) |
| 52 | 54 | { |
| @@ -44,10 +44,14 @@ · 43 unmodified lines | ||
| 44 | 44 | #include "libavutil/mathematics.h" |
| 45 | 45 | #include "libavcodec/aacsbr.h" |
| 46 | 46 | |
| 47 | +DECLARE_ALIGNED(32, static float, sine_96)[96]; | |
| 47 | 48 | DECLARE_ALIGNED(32, static float, sine_120)[120]; |
| 49 | +DECLARE_ALIGNED(32, static float, sine_768)[768]; | |
| 48 | 50 | DECLARE_ALIGNED(32, static float, sine_960)[960]; |
| 49 | 51 | DECLARE_ALIGNED(32, static float, aac_kbd_long_960)[960]; |
| 50 | 52 | DECLARE_ALIGNED(32, static float, aac_kbd_short_120)[120]; |
| 53 | +DECLARE_ALIGNED(32, static float, aac_kbd_long_768)[768]; | |
| 54 | +DECLARE_ALIGNED(32, static float, aac_kbd_short_96)[96]; | |
| 51 | 55 | |
| 52 | 56 | static void init_tables_float_fn(void) |
| 53 | 57 | { |
| @@ -35,10 +35,12 @@ int main(void) · 34 unmodified lines | ||
| 35 | 35 | printf("SINETABLE("#size") = {\n"); \ |
| 36 | 36 | write_int32_t_array(sine_ ## size ## _fixed, size); \ |
| 37 | 37 | printf("};\n") |
| 38 | + PRINT_TABLE(96); | |
| 38 | 39 | PRINT_TABLE(120); |
| 39 | 40 | PRINT_TABLE(128); |
| 40 | 41 | PRINT_TABLE(480); |
| 41 | 42 | PRINT_TABLE(512); |
| 43 | + PRINT_TABLE(768); | |
| 42 | 44 | PRINT_TABLE(960); |
| 43 | 45 | PRINT_TABLE(1024); |
| 44 | 46 | return 0; |
| @@ -44,10 +44,12 @@ · 43 unmodified lines | ||
| 44 | 44 | #include "libavutil/attributes.h" |
| 45 | 45 | |
| 46 | 46 | #define SINETABLE_CONST |
| 47 | +SINETABLE( 96); | |
| 47 | 48 | SINETABLE( 120); |
| 48 | 49 | SINETABLE( 128); |
| 49 | 50 | SINETABLE( 480); |
| 50 | 51 | SINETABLE( 512); |
| 52 | +SINETABLE( 768); | |
| 51 | 53 | SINETABLE( 960); |
| 52 | 54 | SINETABLE(1024); |
| 53 | 55 | |
| @@ -62,10 +64,12 @@ static av_cold void sine_window_init_fixed(int *window, int n) · 8 unmodified lines | ||
| 62 | 64 | |
| 63 | 65 | static av_cold void init_sine_windows_fixed(void) |
| 64 | 66 | { |
| 67 | + sine_window_init_fixed(sine_96_fixed, 96); | |
| 65 | 68 | sine_window_init_fixed(sine_120_fixed, 120); |
| 66 | 69 | sine_window_init_fixed(sine_128_fixed, 128); |
| 67 | 70 | sine_window_init_fixed(sine_480_fixed, 480); |
| 68 | 71 | sine_window_init_fixed(sine_512_fixed, 512); |
| 72 | + sine_window_init_fixed(sine_768_fixed, 768); | |
| 69 | 73 | sine_window_init_fixed(sine_960_fixed, 960); |
| 70 | 74 | sine_window_init_fixed(sine_1024_fixed, 1024); |
| 71 | 75 | } |