1 /*********************************************************************
2 * Copyright (C) 2005-2007 by Prakash Punnoor *
3 * prakash@punnoor.de *
4 * *
5 * This library is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU Library General Public *
7 * License as published by the Free Software Foundation; *
8 * version 2 of the License *
9 * *
10 * This library is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
13 * Library General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU Library General Public *
16 * License along with this library; if not, write to the *
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, *
18 * Boston, MA 02110-1301, USA. *
19 *********************************************************************/
20 #include "x86_sse_mdct_common_init.h"
21 #include "x86_sse_mdct_common.c"
22
23 static void
sse_mdct_close(A52Context * ctx)24 sse_mdct_close(A52Context *ctx)
25 {
26 sse_mdct_ctx_close(&ctx->mdct_ctx_512);
27 sse_mdct_ctx_close(&ctx->mdct_ctx_256);
28 }
29
30 static void
sse_mdct_thread_close(A52ThreadContext * tctx)31 sse_mdct_thread_close(A52ThreadContext *tctx)
32 {
33 sse_mdct_tctx_close(&tctx->mdct_tctx_512);
34 sse_mdct_tctx_close(&tctx->mdct_tctx_256);
35
36 aligned_free(tctx->frame.blocks[0].input_samples[0]);
37 }
38
39 void
sse_mdct_init(A52Context * ctx)40 sse_mdct_init(A52Context *ctx)
41 {
42 sse_mdct_ctx_init(&ctx->mdct_ctx_512, 512);
43 sse_mdct_ctx_init(&ctx->mdct_ctx_256, 256);
44
45 ctx->mdct_ctx_512.mdct = mdct_512;
46 ctx->mdct_ctx_256.mdct = mdct_256;
47
48 ctx->mdct_ctx_512.mdct_close = sse_mdct_close;
49 ctx->mdct_ctx_256.mdct_close = sse_mdct_close;
50 }
51
52 void
sse_mdct_thread_init(A52ThreadContext * tctx)53 sse_mdct_thread_init(A52ThreadContext *tctx)
54 {
55 sse_mdct_tctx_init(&tctx->mdct_tctx_512, 512);
56 sse_mdct_tctx_init(&tctx->mdct_tctx_256, 256);
57
58 tctx->mdct_tctx_512.mdct_thread_close = sse_mdct_thread_close;
59 tctx->mdct_tctx_256.mdct_thread_close = sse_mdct_thread_close;
60
61 tctx->mdct_tctx_512.mdct = &tctx->ctx->mdct_ctx_512;
62 tctx->mdct_tctx_256.mdct = &tctx->ctx->mdct_ctx_256;
63
64 tctx->frame.blocks[0].input_samples[0] =
65 aligned_malloc(A52_NUM_BLOCKS * A52_MAX_CHANNELS * (256 + 512) * sizeof(FLOAT));
66 alloc_block_buffers(tctx);
67 }
68