mirror of https://github.com/FFmpeg/FFmpeg.git
Originally committed as revision 23647 to svn://svn.ffmpeg.org/ffmpeg/trunkoldabi
parent
4d49a5a785
commit
a20639017b
12 changed files with 1733 additions and 12 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,80 @@ |
|||||||
|
/*
|
||||||
|
* MPEG-4 Parametric Stereo definitions and declarations |
||||||
|
* Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> |
||||||
|
* |
||||||
|
* This file is part of FFmpeg. |
||||||
|
* |
||||||
|
* FFmpeg is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU Lesser General Public |
||||||
|
* License as published by the Free Software Foundation; either |
||||||
|
* version 2.1 of the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* FFmpeg is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||||
|
* Lesser General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Lesser General Public |
||||||
|
* License along with FFmpeg; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef AVCODEC_PS_H |
||||||
|
#define AVCODEC_PS_H |
||||||
|
|
||||||
|
#include <stdint.h> |
||||||
|
|
||||||
|
#define PS_MAX_NUM_ENV 5 |
||||||
|
#define PS_MAX_NR_IIDICC 34 |
||||||
|
#define PS_MAX_NR_IPDOPD 17 |
||||||
|
#define PS_MAX_SSB 91 |
||||||
|
#define PS_MAX_AP_BANDS 50 |
||||||
|
#define PS_QMF_TIME_SLOTS 32 |
||||||
|
#define PS_MAX_DELAY 14 |
||||||
|
#define PS_AP_LINKS 3 |
||||||
|
#define PS_MAX_AP_DELAY 5 |
||||||
|
|
||||||
|
typedef struct { |
||||||
|
int start; |
||||||
|
int enable_iid; |
||||||
|
int iid_mode; |
||||||
|
int iid_quant; |
||||||
|
int nr_iid_par; |
||||||
|
int nr_ipdopd_par; |
||||||
|
int enable_icc; |
||||||
|
int icc_mode; |
||||||
|
int nr_icc_par; |
||||||
|
int enable_ext; |
||||||
|
int frame_class; |
||||||
|
int num_env_old; |
||||||
|
int num_env; |
||||||
|
int enable_ipdopd; |
||||||
|
int border_position[PS_MAX_NUM_ENV+1]; |
||||||
|
int8_t iid_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Inter-channel Intensity Difference Parameters
|
||||||
|
int8_t icc_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Inter-Channel Coherence Parameters
|
||||||
|
/* ipd/opd is iid/icc sized so that the same functions can handle both */ |
||||||
|
int8_t ipd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Inter-channel Phase Difference Parameters
|
||||||
|
int8_t opd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Overall Phase Difference Parameters
|
||||||
|
int is34bands; |
||||||
|
int is34bands_old; |
||||||
|
|
||||||
|
float in_buf[5][44][2]; |
||||||
|
float delay[PS_MAX_SSB][PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2]; |
||||||
|
float ap_delay[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2]; |
||||||
|
float peak_decay_nrg[34]; |
||||||
|
float power_smooth[34]; |
||||||
|
float peak_decay_diff_smooth[34]; |
||||||
|
float H11[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; |
||||||
|
float H12[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; |
||||||
|
float H21[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; |
||||||
|
float H22[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; |
||||||
|
int8_t opd_hist[PS_MAX_NR_IIDICC]; |
||||||
|
int8_t ipd_hist[PS_MAX_NR_IIDICC]; |
||||||
|
} PSContext; |
||||||
|
|
||||||
|
void ff_ps_init(void); |
||||||
|
void ff_ps_ctx_init(PSContext *ps); |
||||||
|
int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int bits_left); |
||||||
|
int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top); |
||||||
|
|
||||||
|
#endif /* AVCODEC_PS_H */ |
@ -0,0 +1,93 @@ |
|||||||
|
/*
|
||||||
|
* Generate a header file for hardcoded Parametric Stereo tables |
||||||
|
* |
||||||
|
* Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> |
||||||
|
* |
||||||
|
* This file is part of FFmpeg. |
||||||
|
* |
||||||
|
* FFmpeg is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU Lesser General Public |
||||||
|
* License as published by the Free Software Foundation; either |
||||||
|
* version 2.1 of the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* FFmpeg is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||||
|
* Lesser General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Lesser General Public |
||||||
|
* License along with FFmpeg; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <stdlib.h> |
||||||
|
#define CONFIG_HARDCODED_TABLES 0 |
||||||
|
#include "ps_tablegen.h" |
||||||
|
#include "tableprint.h" |
||||||
|
|
||||||
|
void write_float_3d_array (const void *p, int b, int c, int d) |
||||||
|
{ |
||||||
|
int i; |
||||||
|
const float *f = p; |
||||||
|
for (i = 0; i < b; i++) { |
||||||
|
printf("{\n"); |
||||||
|
write_float_2d_array(f, c, d); |
||||||
|
printf("},\n"); |
||||||
|
f += c * d; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void write_float_4d_array (const void *p, int a, int b, int c, int d) |
||||||
|
{ |
||||||
|
int i; |
||||||
|
const float *f = p; |
||||||
|
for (i = 0; i < a; i++) { |
||||||
|
printf("{\n"); |
||||||
|
write_float_3d_array(f, b, c, d); |
||||||
|
printf("},\n"); |
||||||
|
f += b * c * d; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
int main(void) |
||||||
|
{ |
||||||
|
ps_tableinit(); |
||||||
|
|
||||||
|
write_fileheader(); |
||||||
|
|
||||||
|
printf("static const float pd_re_smooth[8*8*8] = {\n"); |
||||||
|
write_float_array(pd_re_smooth, 8*8*8); |
||||||
|
printf("};\n"); |
||||||
|
printf("static const float pd_im_smooth[8*8*8] = {\n"); |
||||||
|
write_float_array(pd_im_smooth, 8*8*8); |
||||||
|
printf("};\n"); |
||||||
|
|
||||||
|
printf("static const float HA[46][8][4] = {\n"); |
||||||
|
write_float_3d_array(HA, 46, 8, 4); |
||||||
|
printf("};\n"); |
||||||
|
printf("static const float HB[46][8][4] = {\n"); |
||||||
|
write_float_3d_array(HB, 46, 8, 4); |
||||||
|
printf("};\n"); |
||||||
|
|
||||||
|
printf("static const float f20_0_8[8][7][2] = {\n"); |
||||||
|
write_float_3d_array(f20_0_8, 8, 7, 2); |
||||||
|
printf("};\n"); |
||||||
|
printf("static const float f34_0_12[12][7][2] = {\n"); |
||||||
|
write_float_3d_array(f34_0_12, 12, 7, 2); |
||||||
|
printf("};\n"); |
||||||
|
printf("static const float f34_1_8[8][7][2] = {\n"); |
||||||
|
write_float_3d_array(f34_1_8, 8, 7, 2); |
||||||
|
printf("};\n"); |
||||||
|
printf("static const float f34_2_4[4][7][2] = {\n"); |
||||||
|
write_float_3d_array(f34_2_4, 4, 7, 2); |
||||||
|
printf("};\n"); |
||||||
|
|
||||||
|
printf("static const float Q_fract_allpass[2][50][3][2] = {\n"); |
||||||
|
write_float_4d_array(Q_fract_allpass, 2, 50, 3, 2); |
||||||
|
printf("};\n"); |
||||||
|
printf("static const float phi_fract[2][50][2] = {\n"); |
||||||
|
write_float_3d_array(phi_fract, 2, 50, 2); |
||||||
|
printf("};\n"); |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,221 @@ |
|||||||
|
/*
|
||||||
|
* Header file for hardcoded Parametric Stereo tables |
||||||
|
* |
||||||
|
* Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> |
||||||
|
* |
||||||
|
* This file is part of FFmpeg. |
||||||
|
* |
||||||
|
* FFmpeg is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU Lesser General Public |
||||||
|
* License as published by the Free Software Foundation; either |
||||||
|
* version 2.1 of the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* FFmpeg is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||||
|
* Lesser General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Lesser General Public |
||||||
|
* License along with FFmpeg; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef PS_TABLEGEN_H |
||||||
|
#define PS_TABLEGEN_H |
||||||
|
|
||||||
|
#include <stdint.h> |
||||||
|
#include <math.h> |
||||||
|
|
||||||
|
#if CONFIG_HARDCODED_TABLES |
||||||
|
#define ps_tableinit() |
||||||
|
#include "libavcodec/ps_tables.h" |
||||||
|
#else |
||||||
|
#include "../libavutil/common.h" |
||||||
|
#ifndef M_SQRT1_2 |
||||||
|
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ |
||||||
|
#endif |
||||||
|
#ifndef M_PI |
||||||
|
#define M_PI 3.14159265358979323846 /* pi */ |
||||||
|
#endif |
||||||
|
#ifndef M_SQRT2 |
||||||
|
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ |
||||||
|
#endif |
||||||
|
#define NR_ALLPASS_BANDS20 30 |
||||||
|
#define NR_ALLPASS_BANDS34 50 |
||||||
|
#define PS_AP_LINKS 3 |
||||||
|
static float pd_re_smooth[8*8*8]; |
||||||
|
static float pd_im_smooth[8*8*8]; |
||||||
|
static float HA[46][8][4]; |
||||||
|
static float HB[46][8][4]; |
||||||
|
static float f20_0_8 [ 8][7][2]; |
||||||
|
static float f34_0_12[12][7][2]; |
||||||
|
static float f34_1_8 [ 8][7][2]; |
||||||
|
static float f34_2_4 [ 4][7][2]; |
||||||
|
static float Q_fract_allpass[2][50][3][2]; |
||||||
|
static float phi_fract[2][50][2]; |
||||||
|
|
||||||
|
static const float g0_Q8[] = { |
||||||
|
0.00746082949812f, 0.02270420949825f, 0.04546865930473f, 0.07266113929591f, |
||||||
|
0.09885108575264f, 0.11793710567217f, 0.125f |
||||||
|
}; |
||||||
|
|
||||||
|
static const float g0_Q12[] = { |
||||||
|
0.04081179924692f, 0.03812810994926f, 0.05144908135699f, 0.06399831151592f, |
||||||
|
0.07428313801106f, 0.08100347892914f, 0.08333333333333f |
||||||
|
}; |
||||||
|
|
||||||
|
static const float g1_Q8[] = { |
||||||
|
0.01565675600122f, 0.03752716391991f, 0.05417891378782f, 0.08417044116767f, |
||||||
|
0.10307344158036f, 0.12222452249753f, 0.125f |
||||||
|
}; |
||||||
|
|
||||||
|
static const float g2_Q4[] = { |
||||||
|
-0.05908211155639f, -0.04871498374946f, 0.0f, 0.07778723915851f, |
||||||
|
0.16486303567403f, 0.23279856662996f, 0.25f |
||||||
|
}; |
||||||
|
|
||||||
|
static void make_filters_from_proto(float (*filter)[7][2], const float *proto, int bands) |
||||||
|
{ |
||||||
|
int q, n; |
||||||
|
for (q = 0; q < bands; q++) { |
||||||
|
for (n = 0; n < 7; n++) { |
||||||
|
double theta = 2 * M_PI * (q + 0.5) * (n - 6) / bands; |
||||||
|
filter[q][n][0] = proto[n] * cos(theta); |
||||||
|
filter[q][n][1] = proto[n] * -sin(theta); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
static void ps_tableinit(void) |
||||||
|
{ |
||||||
|
static const float ipdopd_sin[] = { 0, M_SQRT1_2, 1, M_SQRT1_2, 0, -M_SQRT1_2, -1, -M_SQRT1_2 }; |
||||||
|
static const float ipdopd_cos[] = { 1, M_SQRT1_2, 0, -M_SQRT1_2, -1, -M_SQRT1_2, 0, M_SQRT1_2 }; |
||||||
|
int pd0, pd1, pd2; |
||||||
|
|
||||||
|
static const float iid_par_dequant[] = { |
||||||
|
//iid_par_dequant_default
|
||||||
|
0.05623413251903, 0.12589254117942, 0.19952623149689, 0.31622776601684, |
||||||
|
0.44668359215096, 0.63095734448019, 0.79432823472428, 1, |
||||||
|
1.25892541179417, 1.58489319246111, 2.23872113856834, 3.16227766016838, |
||||||
|
5.01187233627272, 7.94328234724282, 17.7827941003892, |
||||||
|
//iid_par_dequant_fine
|
||||||
|
0.00316227766017, 0.00562341325190, 0.01, 0.01778279410039, |
||||||
|
0.03162277660168, 0.05623413251903, 0.07943282347243, 0.11220184543020, |
||||||
|
0.15848931924611, 0.22387211385683, 0.31622776601684, 0.39810717055350, |
||||||
|
0.50118723362727, 0.63095734448019, 0.79432823472428, 1, |
||||||
|
1.25892541179417, 1.58489319246111, 1.99526231496888, 2.51188643150958, |
||||||
|
3.16227766016838, 4.46683592150963, 6.30957344480193, 8.91250938133745, |
||||||
|
12.5892541179417, 17.7827941003892, 31.6227766016838, 56.2341325190349, |
||||||
|
100, 177.827941003892, 316.227766016837, |
||||||
|
}; |
||||||
|
static const float icc_invq[] = { |
||||||
|
1, 0.937, 0.84118, 0.60092, 0.36764, 0, -0.589, -1 |
||||||
|
}; |
||||||
|
static const float acos_icc_invq[] = { |
||||||
|
0, 0.35685527, 0.57133466, 0.92614472, 1.1943263, M_PI/2, 2.2006171, M_PI |
||||||
|
}; |
||||||
|
int iid, icc; |
||||||
|
|
||||||
|
int k, m; |
||||||
|
static const int8_t f_center_20[] = { |
||||||
|
-3, -1, 1, 3, 5, 7, 10, 14, 18, 22, |
||||||
|
}; |
||||||
|
static const int8_t f_center_34[] = { |
||||||
|
2, 6, 10, 14, 18, 22, 26, 30, |
||||||
|
34,-10, -6, -2, 51, 57, 15, 21, |
||||||
|
27, 33, 39, 45, 54, 66, 78, 42, |
||||||
|
102, 66, 78, 90,102,114,126, 90, |
||||||
|
}; |
||||||
|
static const float fractional_delay_links[] = { 0.43f, 0.75f, 0.347f }; |
||||||
|
const float fractional_delay_gain = 0.39f; |
||||||
|
|
||||||
|
for (pd0 = 0; pd0 < 8; pd0++) { |
||||||
|
float pd0_re = ipdopd_cos[pd0]; |
||||||
|
float pd0_im = ipdopd_sin[pd0]; |
||||||
|
for (pd1 = 0; pd1 < 8; pd1++) { |
||||||
|
float pd1_re = ipdopd_cos[pd1]; |
||||||
|
float pd1_im = ipdopd_sin[pd1]; |
||||||
|
for (pd2 = 0; pd2 < 8; pd2++) { |
||||||
|
float pd2_re = ipdopd_cos[pd2]; |
||||||
|
float pd2_im = ipdopd_sin[pd2]; |
||||||
|
float re_smooth = 0.25f * pd0_re + 0.5f * pd1_re + pd2_re; |
||||||
|
float im_smooth = 0.25f * pd0_im + 0.5f * pd1_im + pd2_im; |
||||||
|
float pd_mag = 1 / sqrt(im_smooth * im_smooth + re_smooth * re_smooth); |
||||||
|
pd_re_smooth[pd0*64+pd1*8+pd2] = re_smooth * pd_mag; |
||||||
|
pd_im_smooth[pd0*64+pd1*8+pd2] = im_smooth * pd_mag; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
for (iid = 0; iid < 46; iid++) { |
||||||
|
float c = iid_par_dequant[iid]; //<Linear Inter-channel Intensity Difference
|
||||||
|
float c1 = (float)M_SQRT2 / sqrtf(1.0f + c*c); |
||||||
|
float c2 = c * c1; |
||||||
|
for (icc = 0; icc < 8; icc++) { |
||||||
|
/*if (PS_BASELINE || ps->icc_mode < 3)*/ { |
||||||
|
float alpha = 0.5f * acos_icc_invq[icc]; |
||||||
|
float beta = alpha * (c1 - c2) * (float)M_SQRT1_2; |
||||||
|
HA[iid][icc][0] = c2 * cosf(beta + alpha); |
||||||
|
HA[iid][icc][1] = c1 * cosf(beta - alpha); |
||||||
|
HA[iid][icc][2] = c2 * sinf(beta + alpha); |
||||||
|
HA[iid][icc][3] = c1 * sinf(beta - alpha); |
||||||
|
} /* else */ { |
||||||
|
float alpha, gamma, mu, rho; |
||||||
|
float alpha_c, alpha_s, gamma_c, gamma_s; |
||||||
|
rho = FFMAX(icc_invq[icc], 0.05f); |
||||||
|
alpha = 0.5f * atan2f(2.0f * c * rho, c*c - 1.0f); |
||||||
|
mu = c + 1.0f / c; |
||||||
|
mu = sqrtf(1 + (4 * rho * rho - 4)/(mu * mu)); |
||||||
|
gamma = atanf(sqrtf((1.0f - mu)/(1.0f + mu))); |
||||||
|
if (alpha < 0) alpha += M_PI/2; |
||||||
|
alpha_c = cosf(alpha); |
||||||
|
alpha_s = sinf(alpha); |
||||||
|
gamma_c = cosf(gamma); |
||||||
|
gamma_s = sinf(gamma); |
||||||
|
HB[iid][icc][0] = M_SQRT2 * alpha_c * gamma_c; |
||||||
|
HB[iid][icc][1] = M_SQRT2 * alpha_s * gamma_c; |
||||||
|
HB[iid][icc][2] = -M_SQRT2 * alpha_s * gamma_s; |
||||||
|
HB[iid][icc][3] = M_SQRT2 * alpha_c * gamma_s; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
for (k = 0; k < NR_ALLPASS_BANDS20; k++) { |
||||||
|
double f_center, theta; |
||||||
|
if (k < FF_ARRAY_ELEMS(f_center_20)) |
||||||
|
f_center = f_center_20[k] * 0.125; |
||||||
|
else |
||||||
|
f_center = k - 6.5f; |
||||||
|
for (m = 0; m < PS_AP_LINKS; m++) { |
||||||
|
theta = -M_PI * fractional_delay_links[m] * f_center; |
||||||
|
Q_fract_allpass[0][k][m][0] = cos(theta); |
||||||
|
Q_fract_allpass[0][k][m][1] = sin(theta); |
||||||
|
} |
||||||
|
theta = -M_PI*fractional_delay_gain*f_center; |
||||||
|
phi_fract[0][k][0] = cos(theta); |
||||||
|
phi_fract[0][k][1] = sin(theta); |
||||||
|
} |
||||||
|
for (k = 0; k < NR_ALLPASS_BANDS34; k++) { |
||||||
|
double f_center, theta; |
||||||
|
if (k < FF_ARRAY_ELEMS(f_center_34)) |
||||||
|
f_center = f_center_34[k] / 24.; |
||||||
|
else |
||||||
|
f_center = k - 26.5f; |
||||||
|
for (m = 0; m < PS_AP_LINKS; m++) { |
||||||
|
theta = -M_PI * fractional_delay_links[m] * f_center; |
||||||
|
Q_fract_allpass[1][k][m][0] = cos(theta); |
||||||
|
Q_fract_allpass[1][k][m][1] = sin(theta); |
||||||
|
} |
||||||
|
theta = -M_PI*fractional_delay_gain*f_center; |
||||||
|
phi_fract[1][k][0] = cos(theta); |
||||||
|
phi_fract[1][k][1] = sin(theta); |
||||||
|
} |
||||||
|
|
||||||
|
make_filters_from_proto(f20_0_8, g0_Q8, 8); |
||||||
|
make_filters_from_proto(f34_0_12, g0_Q12, 12); |
||||||
|
make_filters_from_proto(f34_1_8, g1_Q8, 8); |
||||||
|
make_filters_from_proto(f34_2_4, g2_Q4, 4); |
||||||
|
} |
||||||
|
#endif /* CONFIG_HARDCODED_TABLES */ |
||||||
|
|
||||||
|
#endif /* PS_TABLEGEN_H */ |
@ -0,0 +1,163 @@ |
|||||||
|
/*
|
||||||
|
* MPEG-4 Parametric Stereo data tables |
||||||
|
* Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> |
||||||
|
* |
||||||
|
* This file is part of FFmpeg. |
||||||
|
* |
||||||
|
* FFmpeg is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU Lesser General Public |
||||||
|
* License as published by the Free Software Foundation; either |
||||||
|
* version 2.1 of the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* FFmpeg is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||||
|
* Lesser General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Lesser General Public |
||||||
|
* License along with FFmpeg; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
*/ |
||||||
|
|
||||||
|
static const uint8_t huff_iid_df1_bits[] = { |
||||||
|
18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 18, 17, 17, 16, 16, 15, 14, 14, |
||||||
|
13, 12, 12, 11, 10, 10, 8, 7, 6, 5, 4, 3, 1, 3, 4, 5, 6, 7, |
||||||
|
8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 16, 17, 17, 18, 17, 18, 18, |
||||||
|
18, 18, 18, 18, 18, 18, 18, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint32_t huff_iid_df1_codes[] = { |
||||||
|
0x01FEB4, 0x01FEB5, 0x01FD76, 0x01FD77, 0x01FD74, 0x01FD75, 0x01FE8A, |
||||||
|
0x01FE8B, 0x01FE88, 0x00FE80, 0x01FEB6, 0x00FE82, 0x00FEB8, 0x007F42, |
||||||
|
0x007FAE, 0x003FAF, 0x001FD1, 0x001FE9, 0x000FE9, 0x0007EA, 0x0007FB, |
||||||
|
0x0003FB, 0x0001FB, 0x0001FF, 0x00007C, 0x00003C, 0x00001C, 0x00000C, |
||||||
|
0x000000, 0x000001, 0x000001, 0x000002, 0x000001, 0x00000D, 0x00001D, |
||||||
|
0x00003D, 0x00007D, 0x0000FC, 0x0001FC, 0x0003FC, 0x0003F4, 0x0007EB, |
||||||
|
0x000FEA, 0x001FEA, 0x001FD6, 0x003FD0, 0x007FAF, 0x007F43, 0x00FEB9, |
||||||
|
0x00FE83, 0x01FEB7, 0x00FE81, 0x01FE89, 0x01FE8E, 0x01FE8F, 0x01FE8C, |
||||||
|
0x01FE8D, 0x01FEB2, 0x01FEB3, 0x01FEB0, 0x01FEB1, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_iid_dt1_bits[] = { |
||||||
|
16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 13, |
||||||
|
13, 13, 12, 12, 11, 10, 9, 9, 7, 6, 5, 3, 1, 2, 5, 6, 7, 8, |
||||||
|
9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, |
||||||
|
16, 16, 16, 16, 16, 16, 16, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint16_t huff_iid_dt1_codes[] = { |
||||||
|
0x004ED4, 0x004ED5, 0x004ECE, 0x004ECF, 0x004ECC, 0x004ED6, 0x004ED8, |
||||||
|
0x004F46, 0x004F60, 0x002718, 0x002719, 0x002764, 0x002765, 0x00276D, |
||||||
|
0x0027B1, 0x0013B7, 0x0013D6, 0x0009C7, 0x0009E9, 0x0009ED, 0x0004EE, |
||||||
|
0x0004F7, 0x000278, 0x000139, 0x00009A, 0x00009F, 0x000020, 0x000011, |
||||||
|
0x00000A, 0x000003, 0x000001, 0x000000, 0x00000B, 0x000012, 0x000021, |
||||||
|
0x00004C, 0x00009B, 0x00013A, 0x000279, 0x000270, 0x0004EF, 0x0004E2, |
||||||
|
0x0009EA, 0x0009D8, 0x0013D7, 0x0013D0, 0x0027B2, 0x0027A2, 0x00271A, |
||||||
|
0x00271B, 0x004F66, 0x004F67, 0x004F61, 0x004F47, 0x004ED9, 0x004ED7, |
||||||
|
0x004ECD, 0x004ED2, 0x004ED3, 0x004ED0, 0x004ED1, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_iid_df0_bits[] = { |
||||||
|
17, 17, 17, 17, 16, 15, 13, 10, 9, 7, 6, 5, 4, 3, 1, 3, 4, 5, |
||||||
|
6, 6, 8, 11, 13, 14, 14, 15, 17, 18, 18, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint32_t huff_iid_df0_codes[] = { |
||||||
|
0x01FFFB, 0x01FFFC, 0x01FFFD, 0x01FFFA, 0x00FFFC, 0x007FFC, 0x001FFD, |
||||||
|
0x0003FE, 0x0001FE, 0x00007E, 0x00003C, 0x00001D, 0x00000D, 0x000005, |
||||||
|
0x000000, 0x000004, 0x00000C, 0x00001C, 0x00003D, 0x00003E, 0x0000FE, |
||||||
|
0x0007FE, 0x001FFC, 0x003FFC, 0x003FFD, 0x007FFD, 0x01FFFE, 0x03FFFE, |
||||||
|
0x03FFFF, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_iid_dt0_bits[] = { |
||||||
|
19, 19, 19, 20, 20, 20, 17, 15, 12, 10, 8, 6, 4, 2, 1, 3, 5, 7, |
||||||
|
9, 11, 13, 14, 17, 19, 20, 20, 20, 20, 20, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint32_t huff_iid_dt0_codes[] = { |
||||||
|
0x07FFF9, 0x07FFFA, 0x07FFFB, 0x0FFFF8, 0x0FFFF9, 0x0FFFFA, 0x01FFFD, |
||||||
|
0x007FFE, 0x000FFE, 0x0003FE, 0x0000FE, 0x00003E, 0x00000E, 0x000002, |
||||||
|
0x000000, 0x000006, 0x00001E, 0x00007E, 0x0001FE, 0x0007FE, 0x001FFE, |
||||||
|
0x003FFE, 0x01FFFC, 0x07FFF8, 0x0FFFFB, 0x0FFFFC, 0x0FFFFD, 0x0FFFFE, |
||||||
|
0x0FFFFF, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_icc_df_bits[] = { |
||||||
|
14, 14, 12, 10, 7, 5, 3, 1, 2, 4, 6, 8, 9, 11, 13, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint16_t huff_icc_df_codes[] = { |
||||||
|
0x3FFF, 0x3FFE, 0x0FFE, 0x03FE, 0x007E, 0x001E, 0x0006, 0x0000, |
||||||
|
0x0002, 0x000E, 0x003E, 0x00FE, 0x01FE, 0x07FE, 0x1FFE, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_icc_dt_bits[] = { |
||||||
|
14, 13, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12, 14, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint16_t huff_icc_dt_codes[] = { |
||||||
|
0x3FFE, 0x1FFE, 0x07FE, 0x01FE, 0x007E, 0x001E, 0x0006, 0x0000, |
||||||
|
0x0002, 0x000E, 0x003E, 0x00FE, 0x03FE, 0x0FFE, 0x3FFF, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_ipd_df_bits[] = { |
||||||
|
1, 3, 4, 4, 4, 4, 4, 4, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_ipd_df_codes[] = { |
||||||
|
0x01, 0x00, 0x06, 0x04, 0x02, 0x03, 0x05, 0x07, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_ipd_dt_bits[] = { |
||||||
|
1, 3, 4, 5, 5, 4, 4, 3, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_ipd_dt_codes[] = { |
||||||
|
0x01, 0x02, 0x02, 0x03, 0x02, 0x00, 0x03, 0x03, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_opd_df_bits[] = { |
||||||
|
1, 3, 4, 4, 5, 5, 4, 3, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_opd_df_codes[] = { |
||||||
|
0x01, 0x01, 0x06, 0x04, 0x0F, 0x0E, 0x05, 0x00, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_opd_dt_bits[] = { |
||||||
|
1, 3, 4, 5, 5, 4, 4, 3, |
||||||
|
}; |
||||||
|
|
||||||
|
static const uint8_t huff_opd_dt_codes[] = { |
||||||
|
0x01, 0x02, 0x01, 0x07, 0x06, 0x00, 0x02, 0x03, |
||||||
|
}; |
||||||
|
|
||||||
|
static const int8_t huff_offset[] = { |
||||||
|
30, 30, |
||||||
|
14, 14, |
||||||
|
7, 7, |
||||||
|
0, 0, |
||||||
|
0, 0, |
||||||
|
}; |
||||||
|
|
||||||
|
///Table 8.48
|
||||||
|
static const int8_t k_to_i_20[] = { |
||||||
|
1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 15, |
||||||
|
15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, |
||||||
|
18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, |
||||||
|
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 |
||||||
|
}; |
||||||
|
///Table 8.49
|
||||||
|
static const int8_t k_to_i_34[] = { |
||||||
|
0, 1, 2, 3, 4, 5, 6, 6, 7, 2, 1, 0, 10, 10, 4, 5, 6, 7, 8, |
||||||
|
9, 10, 11, 12, 9, 14, 11, 12, 13, 14, 15, 16, 13, 16, 17, 18, 19, 20, 21, |
||||||
|
22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, |
||||||
|
30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, |
||||||
|
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33 |
||||||
|
}; |
||||||
|
|
||||||
|
static const float g1_Q2[] = { |
||||||
|
0.0f, 0.01899487526049f, 0.0f, -0.07293139167538f, |
||||||
|
0.0f, 0.30596630545168f, 0.5f |
||||||
|
}; |
Loading…
Reference in new issue