History

Merge commit '27245b4e1bbb7a863341db321b5bdc5792e427d9'

* commit '27245b4e1bbb7a863341db321b5bdc5792e427d9': dca: remove embedded downmix coefficient extraction. Conflicts: libavcodec/dcadata.h libavcodec/dcadec.c

Michael Niedermayer committed 12 years ago

Commit c122e692 parents a7f8817 27245b42 files · +17 −43Browse files

Unified · Split

2 files
  1. libavcodec/dcadata.h +0 −16
  2. libavcodec/dcadec.c +17 −27
libavcodec/dcadata.h+0−16
@@ -7505,22 +7505,6 @@ DECLARE_ALIGNED(16, static const float, lfe_fir_128)[] = · 7504 unmodified lines
75057505 0.01724460535, 0.47964480519, 0.48503074050, 0.01805862412,
75067506 };
75077507
7508−/* 10^-(dB/20), with dB being a list of dB values ranging from 0 to -72 */
7509−/* do a 20*log10(dca_downmix_coeffs) to reconvert the values */
7510−
7511−static const float dca_downmix_coeffs[65] = {
7512− 1.000000000000000, 0.988553094656939, 0.971627951577106, 0.944060876285923, 0.917275935389780, 0.891250938133746,
7513− 0.865964323360065, 0.841395141645195, 0.817523037943650, 0.794328234724281, 0.771791515585012, 0.749894209332456,
7514− 0.728618174513228, 0.707945784384138, 0.687859912308808, 0.668343917568615, 0.649381631576211, 0.630957344480193,
7515− 0.613055792149821, 0.595662143529010, 0.578761988349121, 0.562341325190349, 0.546386549881854, 0.530884444230988,
7516− 0.515822165072306, 0.501187233627272, 0.446683592150963, 0.398107170553497, 0.354813389233575, 0.316227766016838,
7517− 0.281838293126445, 0.251188643150958, 0.223872113856834, 0.199526231496888, 0.177827941003892, 0.158489319246111,
7518− 0.141253754462275, 0.125892541179417, 0.112201845430196, 0.100000000000000, 0.089125093813374, 0.079432823472428,
7519− 0.070794578438414, 0.063095734448019, 0.053088444423099, 0.044668359215096, 0.037583740428844, 0.031622776601684,
7520− 0.026607250597988, 0.022387211385683, 0.018836490894898, 0.015848931924611, 0.013335214321633, 0.011220184543020,
7521− 0.009440608762859, 0.007943282347243, 0.005623413251903, 0.003981071705535, 0.002818382931264, 0.001995262314969,
7522− 0.001412537544623, 0.001000000000000, 0.000501187233627, 0.000251188643151, 0.000000000000000,
7523−};
75247508
75257509 static const float dca_downmix_scale_factors[241] = {
75267510 0.001000, 0.001059, 0.001122, 0.001189, 0.001259, 0.001334, 0.001413, 0.001496,
libavcodec/dcadec.c+17−27
@@ -358,7 +358,6 @@ typedef struct { · 357 unmodified lines
358358 int bit_rate; ///< transmission bit rate
359359 int bit_rate_index; ///< transmission bit rate index
360360
361− int downmix; ///< embedded downmix enabled
362361 int dynrange; ///< embedded dynamic range flag
363362 int timestamp; ///< embedded time stamp flag
364363 int aux_data; ///< auxiliary data flag
@@ -724,7 +723,7 @@ static int dca_parse_frame_header(DCAContext *s) · 359 unmodified lines
724723 if (!s->bit_rate)
725724 return AVERROR_INVALIDDATA;
726725
727− s->downmix = get_bits(&s->gb, 1); /* note: this is FixedBit == 0 */
726+ skip_bits1(&s->gb); // always 0 (reserved, cf. ETSI TS 102 114 V1.4.1)
728727 s->dynrange = get_bits(&s->gb, 1);
729728 s->timestamp = get_bits(&s->gb, 1);
730729 s->aux_data = get_bits(&s->gb, 1);
@@ -771,7 +770,6 @@ static int dca_parse_frame_header(DCAContext *s) · 40 unmodified lines
771770 s->sample_rate);
772771 av_log(s->avctx, AV_LOG_DEBUG, "bit rate: %i bits/s\n",
773772 s->bit_rate);
774− av_log(s->avctx, AV_LOG_DEBUG, "downmix: %i\n", s->downmix);
775773 av_log(s->avctx, AV_LOG_DEBUG, "dynrange: %i\n", s->dynrange);
776774 av_log(s->avctx, AV_LOG_DEBUG, "timestamp: %i\n", s->timestamp);
777775 av_log(s->avctx, AV_LOG_DEBUG, "aux_data: %i\n", s->aux_data);
@@ -956,28 +954,20 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) · 178 unmodified lines
956954
957955 /* Stereo downmix coefficients */
958956 if (!base_channel && s->prim_channels > 2) {
959− if (s->downmix) {
960− for (j = base_channel; j < s->prim_channels; j++) {
961− s->downmix_coef[j][0] = dca_downmix_coeffs[get_bits(&s->gb, 7)];
962− s->downmix_coef[j][1] = dca_downmix_coeffs[get_bits(&s->gb, 7)];
963− }
964− } else {
965− int am = s->amode & DCA_CHANNEL_MASK;
966− if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) {
967− av_log(s->avctx, AV_LOG_ERROR,
968− "Invalid channel mode %d\n", am);
969− return AVERROR_INVALIDDATA;
970− }
971− if (s->prim_channels > FF_ARRAY_ELEMS(dca_default_coeffs[0])) {
972− avpriv_request_sample(s->avctx, "Downmixing %d channels",
973− s->prim_channels);
974− return AVERROR_PATCHWELCOME;
975− }
976−
977− for (j = base_channel; j < s->prim_channels; j++) {
978− s->downmix_coef[j][0] = dca_default_coeffs[am][j][0];
979− s->downmix_coef[j][1] = dca_default_coeffs[am][j][1];
980− }
957+ int am = s->amode & DCA_CHANNEL_MASK;
958+ if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) {
959+ av_log(s->avctx, AV_LOG_ERROR,
960+ "Invalid channel mode %d\n", am);
961+ return AVERROR_INVALIDDATA;
962+ }
963+ if (s->prim_channels > FF_ARRAY_ELEMS(dca_default_coeffs[0])) {
964+ avpriv_request_sample(s->avctx, "Downmixing %d channels",
965+ s->prim_channels);
966+ return AVERROR_PATCHWELCOME;
967+ }
968+ for (j = base_channel; j < s->prim_channels; j++) {
969+ s->downmix_coef[j][0] = dca_default_coeffs[am][j][0];
970+ s->downmix_coef[j][1] = dca_default_coeffs[am][j][1];
981971 }
982972 }
983973
@@ -1080,7 +1070,7 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) · 96 unmodified lines
10801070 av_log(s->avctx, AV_LOG_DEBUG, "\n");
10811071 }
10821072 }
1083− if (!base_channel && s->prim_channels > 2 && s->downmix) {
1073+ if (!base_channel && s->prim_channels > 2) {
10841074 av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n");
10851075 for (j = 0; j < s->prim_channels; j++) {
10861076 av_log(s->avctx, AV_LOG_DEBUG, "Channel 0, %d = %f\n", j,
@@ -1480,7 +1470,7 @@ static int dca_subframe_footer(DCAContext *s, int base_channel) · 393 unmodified lines
14801470 for (i = 0; i < aux_data_count; i++)
14811471 get_bits(&s->gb, 8);
14821472
1483− if (s->crc_present && (s->downmix || s->dynrange))
1473+ if (s->crc_present && s->dynrange)
14841474 get_bits(&s->gb, 16);
14851475 }
14861476

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t