summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libatrac/atrac3.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c
index 838bbca48a..09e923cfa8 100644
--- a/apps/codecs/libatrac/atrac3.c
+++ b/apps/codecs/libatrac/atrac3.c
@@ -118,7 +118,7 @@ typedef struct {
118 //@{ 118 //@{
119 /** data buffers */ 119 /** data buffers */
120 int32_t outSamples[2048]; 120 int32_t outSamples[2048];
121 uint8_t* decoded_bytes_buffer; 121 uint8_t decoded_bytes_buffer[1024];
122 int32_t tempBuf[1070]; 122 int32_t tempBuf[1070];
123 //@} 123 //@}
124 //@{ 124 //@{
@@ -132,7 +132,7 @@ typedef struct {
132 132
133static int32_t qmf_window[48]; 133static int32_t qmf_window[48];
134static VLC spectral_coeff_tab[7]; 134static VLC spectral_coeff_tab[7];
135 135static channel_unit channel_units[32000];
136/** 136/**
137 * Quadrature mirror synthesis filter. 137 * Quadrature mirror synthesis filter.
138 * 138 *
@@ -269,21 +269,7 @@ static av_cold void init_atrac3_transforms(ATRAC3Context *q) {
269} 269}
270 270
271/** 271/**
272 * Atrac3 uninit, free all allocated memory 272 * Mantissa decoding
273 */
274
275static av_cold int atrac3_decode_close(ATRAC3Context *q)
276{
277 //ATRAC3Context *q = rmctx->priv_data;
278
279 av_free(q->pUnits);
280 av_free(q->decoded_bytes_buffer);
281
282 return 0;
283}
284
285/**
286/ * Mantissa decoding
287 * 273 *
288 * @param gb the GetBit context 274 * @param gb the GetBit context
289 * @param selector what table is the output values coded with 275 * @param selector what table is the output values coded with
@@ -1010,11 +996,6 @@ static av_cold int atrac3_decode_init(ATRAC3Context *q, RMContext *rmctx)
1010 if(rmctx->block_align >= UINT16_MAX/2) 996 if(rmctx->block_align >= UINT16_MAX/2)
1011 return -1; 997 return -1;
1012 998
1013 /* Pad the data buffer with FF_INPUT_BUFFER_PADDING_SIZE,
1014 * this is for the bitstream reader. */
1015 if ((q->decoded_bytes_buffer = av_mallocz((rmctx->block_align+(4-rmctx->block_align%4) + FF_INPUT_BUFFER_PADDING_SIZE))) == NULL)
1016 return AVERROR(ENOMEM);
1017
1018 999
1019 /* Initialize the VLC tables. */ 1000 /* Initialize the VLC tables. */
1020 if (!vlcs_initialized) { 1001 if (!vlcs_initialized) {
@@ -1045,12 +1026,8 @@ static av_cold int atrac3_decode_init(ATRAC3Context *q, RMContext *rmctx)
1045 q->matrix_coeff_index_now[i] = 3; 1026 q->matrix_coeff_index_now[i] = 3;
1046 q->matrix_coeff_index_next[i] = 3; 1027 q->matrix_coeff_index_next[i] = 3;
1047 } 1028 }
1048 1029
1049 q->pUnits = av_mallocz(sizeof(channel_unit)*q->channels); 1030 q->pUnits = channel_units;
1050 if (!q->pUnits) {
1051 av_free(q->decoded_bytes_buffer);
1052 return AVERROR(ENOMEM);
1053 }
1054 1031
1055 return 0; 1032 return 0;
1056} 1033}
@@ -1209,7 +1186,6 @@ int main(int argc, char *argv[])
1209 packet_count -= rmctx.audio_pkt_cnt; 1186 packet_count -= rmctx.audio_pkt_cnt;
1210 rmctx.audio_pkt_cnt = 0; 1187 rmctx.audio_pkt_cnt = 0;
1211 } 1188 }
1212 atrac3_decode_close(&q);
1213 close_wav(fd_dec, &rmctx, &q); 1189 close_wav(fd_dec, &rmctx, &q);
1214 close(fd); 1190 close(fd);
1215 1191