Mercurial > libavcodec.hg
comparison qdm2.c @ 9664:df1875099613 libavcodec
Switch from INIT_VLC_USE_STATIC to INIT_VLC_USE_NEW_STATIC in qdm2.
author | banan |
---|---|
date | Sun, 17 May 2009 10:29:40 +0000 |
parents | b76f2d264edb |
children | 87d4e5e27d9f |
comparison
equal
deleted
inserted
replaced
9663:041c635d0f69 | 9664:df1875099613 |
---|---|
276 random_seed = random_seed * 214013 + 2531011; | 276 random_seed = random_seed * 214013 + 2531011; |
277 noise_samples[i] = (delta * (float)((random_seed >> 16) & 0x00007fff) - 1.0); | 277 noise_samples[i] = (delta * (float)((random_seed >> 16) & 0x00007fff) - 1.0); |
278 } | 278 } |
279 } | 279 } |
280 | 280 |
281 static const uint16_t qdm2_vlc_offs[] = { | |
282 0,260,566,598,894,1166,1230,1294,1678,1950,2214,2278,2310,2570,2834,3124,3448,3838, | |
283 }; | |
281 | 284 |
282 static av_cold void qdm2_init_vlc(void) | 285 static av_cold void qdm2_init_vlc(void) |
283 { | 286 { |
287 static int vlcs_initialized = 0; | |
288 static VLC_TYPE qdm2_table[3838][2]; | |
289 | |
290 if (!vlcs_initialized) { | |
291 | |
292 vlc_tab_level.table = &qdm2_table[qdm2_vlc_offs[0]]; | |
293 vlc_tab_level.table_allocated = qdm2_vlc_offs[1] - qdm2_vlc_offs[0]; | |
284 init_vlc (&vlc_tab_level, 8, 24, | 294 init_vlc (&vlc_tab_level, 8, 24, |
285 vlc_tab_level_huffbits, 1, 1, | 295 vlc_tab_level_huffbits, 1, 1, |
286 vlc_tab_level_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 296 vlc_tab_level_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
287 | 297 |
298 vlc_tab_diff.table = &qdm2_table[qdm2_vlc_offs[1]]; | |
299 vlc_tab_diff.table_allocated = qdm2_vlc_offs[2] - qdm2_vlc_offs[1]; | |
288 init_vlc (&vlc_tab_diff, 8, 37, | 300 init_vlc (&vlc_tab_diff, 8, 37, |
289 vlc_tab_diff_huffbits, 1, 1, | 301 vlc_tab_diff_huffbits, 1, 1, |
290 vlc_tab_diff_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 302 vlc_tab_diff_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
291 | 303 |
304 vlc_tab_run.table = &qdm2_table[qdm2_vlc_offs[2]]; | |
305 vlc_tab_run.table_allocated = qdm2_vlc_offs[3] - qdm2_vlc_offs[2]; | |
292 init_vlc (&vlc_tab_run, 5, 6, | 306 init_vlc (&vlc_tab_run, 5, 6, |
293 vlc_tab_run_huffbits, 1, 1, | 307 vlc_tab_run_huffbits, 1, 1, |
294 vlc_tab_run_huffcodes, 1, 1, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 308 vlc_tab_run_huffcodes, 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
295 | 309 |
310 fft_level_exp_alt_vlc.table = &qdm2_table[qdm2_vlc_offs[3]]; | |
311 fft_level_exp_alt_vlc.table_allocated = qdm2_vlc_offs[4] - qdm2_vlc_offs[3]; | |
296 init_vlc (&fft_level_exp_alt_vlc, 8, 28, | 312 init_vlc (&fft_level_exp_alt_vlc, 8, 28, |
297 fft_level_exp_alt_huffbits, 1, 1, | 313 fft_level_exp_alt_huffbits, 1, 1, |
298 fft_level_exp_alt_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 314 fft_level_exp_alt_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
299 | 315 |
316 | |
317 fft_level_exp_vlc.table = &qdm2_table[qdm2_vlc_offs[4]]; | |
318 fft_level_exp_vlc.table_allocated = qdm2_vlc_offs[5] - qdm2_vlc_offs[4]; | |
300 init_vlc (&fft_level_exp_vlc, 8, 20, | 319 init_vlc (&fft_level_exp_vlc, 8, 20, |
301 fft_level_exp_huffbits, 1, 1, | 320 fft_level_exp_huffbits, 1, 1, |
302 fft_level_exp_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 321 fft_level_exp_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
303 | 322 |
323 fft_stereo_exp_vlc.table = &qdm2_table[qdm2_vlc_offs[5]]; | |
324 fft_stereo_exp_vlc.table_allocated = qdm2_vlc_offs[6] - qdm2_vlc_offs[5]; | |
304 init_vlc (&fft_stereo_exp_vlc, 6, 7, | 325 init_vlc (&fft_stereo_exp_vlc, 6, 7, |
305 fft_stereo_exp_huffbits, 1, 1, | 326 fft_stereo_exp_huffbits, 1, 1, |
306 fft_stereo_exp_huffcodes, 1, 1, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 327 fft_stereo_exp_huffcodes, 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
307 | 328 |
329 fft_stereo_phase_vlc.table = &qdm2_table[qdm2_vlc_offs[6]]; | |
330 fft_stereo_phase_vlc.table_allocated = qdm2_vlc_offs[7] - qdm2_vlc_offs[6]; | |
308 init_vlc (&fft_stereo_phase_vlc, 6, 9, | 331 init_vlc (&fft_stereo_phase_vlc, 6, 9, |
309 fft_stereo_phase_huffbits, 1, 1, | 332 fft_stereo_phase_huffbits, 1, 1, |
310 fft_stereo_phase_huffcodes, 1, 1, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 333 fft_stereo_phase_huffcodes, 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
311 | 334 |
335 vlc_tab_tone_level_idx_hi1.table = &qdm2_table[qdm2_vlc_offs[7]]; | |
336 vlc_tab_tone_level_idx_hi1.table_allocated = qdm2_vlc_offs[8] - qdm2_vlc_offs[7]; | |
312 init_vlc (&vlc_tab_tone_level_idx_hi1, 8, 20, | 337 init_vlc (&vlc_tab_tone_level_idx_hi1, 8, 20, |
313 vlc_tab_tone_level_idx_hi1_huffbits, 1, 1, | 338 vlc_tab_tone_level_idx_hi1_huffbits, 1, 1, |
314 vlc_tab_tone_level_idx_hi1_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 339 vlc_tab_tone_level_idx_hi1_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
315 | 340 |
341 vlc_tab_tone_level_idx_mid.table = &qdm2_table[qdm2_vlc_offs[8]]; | |
342 vlc_tab_tone_level_idx_mid.table_allocated = qdm2_vlc_offs[9] - qdm2_vlc_offs[8]; | |
316 init_vlc (&vlc_tab_tone_level_idx_mid, 8, 24, | 343 init_vlc (&vlc_tab_tone_level_idx_mid, 8, 24, |
317 vlc_tab_tone_level_idx_mid_huffbits, 1, 1, | 344 vlc_tab_tone_level_idx_mid_huffbits, 1, 1, |
318 vlc_tab_tone_level_idx_mid_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 345 vlc_tab_tone_level_idx_mid_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
319 | 346 |
347 vlc_tab_tone_level_idx_hi2.table = &qdm2_table[qdm2_vlc_offs[9]]; | |
348 vlc_tab_tone_level_idx_hi2.table_allocated = qdm2_vlc_offs[10] - qdm2_vlc_offs[9]; | |
320 init_vlc (&vlc_tab_tone_level_idx_hi2, 8, 24, | 349 init_vlc (&vlc_tab_tone_level_idx_hi2, 8, 24, |
321 vlc_tab_tone_level_idx_hi2_huffbits, 1, 1, | 350 vlc_tab_tone_level_idx_hi2_huffbits, 1, 1, |
322 vlc_tab_tone_level_idx_hi2_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 351 vlc_tab_tone_level_idx_hi2_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
323 | 352 |
353 vlc_tab_type30.table = &qdm2_table[qdm2_vlc_offs[10]]; | |
354 vlc_tab_type30.table_allocated = qdm2_vlc_offs[11] - qdm2_vlc_offs[10]; | |
324 init_vlc (&vlc_tab_type30, 6, 9, | 355 init_vlc (&vlc_tab_type30, 6, 9, |
325 vlc_tab_type30_huffbits, 1, 1, | 356 vlc_tab_type30_huffbits, 1, 1, |
326 vlc_tab_type30_huffcodes, 1, 1, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 357 vlc_tab_type30_huffcodes, 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
327 | 358 |
359 vlc_tab_type34.table = &qdm2_table[qdm2_vlc_offs[11]]; | |
360 vlc_tab_type34.table_allocated = qdm2_vlc_offs[12] - qdm2_vlc_offs[11]; | |
328 init_vlc (&vlc_tab_type34, 5, 10, | 361 init_vlc (&vlc_tab_type34, 5, 10, |
329 vlc_tab_type34_huffbits, 1, 1, | 362 vlc_tab_type34_huffbits, 1, 1, |
330 vlc_tab_type34_huffcodes, 1, 1, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 363 vlc_tab_type34_huffcodes, 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
331 | 364 |
365 vlc_tab_fft_tone_offset[0].table = &qdm2_table[qdm2_vlc_offs[12]]; | |
366 vlc_tab_fft_tone_offset[0].table_allocated = qdm2_vlc_offs[13] - qdm2_vlc_offs[12]; | |
332 init_vlc (&vlc_tab_fft_tone_offset[0], 8, 23, | 367 init_vlc (&vlc_tab_fft_tone_offset[0], 8, 23, |
333 vlc_tab_fft_tone_offset_0_huffbits, 1, 1, | 368 vlc_tab_fft_tone_offset_0_huffbits, 1, 1, |
334 vlc_tab_fft_tone_offset_0_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 369 vlc_tab_fft_tone_offset_0_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
335 | 370 |
371 vlc_tab_fft_tone_offset[1].table = &qdm2_table[qdm2_vlc_offs[13]]; | |
372 vlc_tab_fft_tone_offset[1].table_allocated = qdm2_vlc_offs[14] - qdm2_vlc_offs[13]; | |
336 init_vlc (&vlc_tab_fft_tone_offset[1], 8, 28, | 373 init_vlc (&vlc_tab_fft_tone_offset[1], 8, 28, |
337 vlc_tab_fft_tone_offset_1_huffbits, 1, 1, | 374 vlc_tab_fft_tone_offset_1_huffbits, 1, 1, |
338 vlc_tab_fft_tone_offset_1_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 375 vlc_tab_fft_tone_offset_1_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
339 | 376 |
377 vlc_tab_fft_tone_offset[2].table = &qdm2_table[qdm2_vlc_offs[14]]; | |
378 vlc_tab_fft_tone_offset[2].table_allocated = qdm2_vlc_offs[15] - qdm2_vlc_offs[14]; | |
340 init_vlc (&vlc_tab_fft_tone_offset[2], 8, 32, | 379 init_vlc (&vlc_tab_fft_tone_offset[2], 8, 32, |
341 vlc_tab_fft_tone_offset_2_huffbits, 1, 1, | 380 vlc_tab_fft_tone_offset_2_huffbits, 1, 1, |
342 vlc_tab_fft_tone_offset_2_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 381 vlc_tab_fft_tone_offset_2_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
343 | 382 |
383 vlc_tab_fft_tone_offset[3].table = &qdm2_table[qdm2_vlc_offs[15]]; | |
384 vlc_tab_fft_tone_offset[3].table_allocated = qdm2_vlc_offs[16] - qdm2_vlc_offs[15]; | |
344 init_vlc (&vlc_tab_fft_tone_offset[3], 8, 35, | 385 init_vlc (&vlc_tab_fft_tone_offset[3], 8, 35, |
345 vlc_tab_fft_tone_offset_3_huffbits, 1, 1, | 386 vlc_tab_fft_tone_offset_3_huffbits, 1, 1, |
346 vlc_tab_fft_tone_offset_3_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 387 vlc_tab_fft_tone_offset_3_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
347 | 388 |
389 vlc_tab_fft_tone_offset[4].table = &qdm2_table[qdm2_vlc_offs[16]]; | |
390 vlc_tab_fft_tone_offset[4].table_allocated = qdm2_vlc_offs[17] - qdm2_vlc_offs[16]; | |
348 init_vlc (&vlc_tab_fft_tone_offset[4], 8, 38, | 391 init_vlc (&vlc_tab_fft_tone_offset[4], 8, 38, |
349 vlc_tab_fft_tone_offset_4_huffbits, 1, 1, | 392 vlc_tab_fft_tone_offset_4_huffbits, 1, 1, |
350 vlc_tab_fft_tone_offset_4_huffcodes, 2, 2, INIT_VLC_USE_STATIC | INIT_VLC_LE); | 393 vlc_tab_fft_tone_offset_4_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
394 | |
395 vlcs_initialized=1; | |
396 } | |
351 } | 397 } |
352 | 398 |
353 | 399 |
354 /* for floating point to fixed point conversion */ | 400 /* for floating point to fixed point conversion */ |
355 static const float f2i_scale = (float) (1 << (FRAC_BITS - 15)); | 401 static const float f2i_scale = (float) (1 << (FRAC_BITS - 15)); |