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
7505 0.01724460535, 0.47964480519, 0.48503074050, 0.01805862412,7505 0.01724460535, 0.47964480519, 0.48503074050, 0.01805862412,
7506};7506};
7507 7507
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
7511static 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};
7524 7508
7525static const float dca_downmix_scale_factors[241] = {7509static const float dca_downmix_scale_factors[241] = {
7526 0.001000, 0.001059, 0.001122, 0.001189, 0.001259, 0.001334, 0.001413, 0.001496,7510 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
358 int bit_rate; ///< transmission bit rate358 int bit_rate; ///< transmission bit rate
359 int bit_rate_index; ///< transmission bit rate index359 int bit_rate_index; ///< transmission bit rate index
360 360
361 int downmix; ///< embedded downmix enabled
362 int dynrange; ///< embedded dynamic range flag361 int dynrange; ///< embedded dynamic range flag
363 int timestamp; ///< embedded time stamp flag362 int timestamp; ///< embedded time stamp flag
364 int aux_data; ///< auxiliary data flag363 int aux_data; ///< auxiliary data flag
@@ -724,7 +723,7 @@ static int dca_parse_frame_header(DCAContext *s) · 359 unmodified lines
724 if (!s->bit_rate)723 if (!s->bit_rate)
725 return AVERROR_INVALIDDATA;724 return AVERROR_INVALIDDATA;
726 725
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)
728 s->dynrange = get_bits(&s->gb, 1);727 s->dynrange = get_bits(&s->gb, 1);
729 s->timestamp = get_bits(&s->gb, 1);728 s->timestamp = get_bits(&s->gb, 1);
730 s->aux_data = get_bits(&s->gb, 1);729 s->aux_data = get_bits(&s->gb, 1);
@@ -771,7 +770,6 @@ static int dca_parse_frame_header(DCAContext *s) · 40 unmodified lines
771 s->sample_rate);770 s->sample_rate);
772 av_log(s->avctx, AV_LOG_DEBUG, "bit rate: %i bits/s\n",771 av_log(s->avctx, AV_LOG_DEBUG, "bit rate: %i bits/s\n",
773 s->bit_rate);772 s->bit_rate);
774 av_log(s->avctx, AV_LOG_DEBUG, "downmix: %i\n", s->downmix);
775 av_log(s->avctx, AV_LOG_DEBUG, "dynrange: %i\n", s->dynrange);773 av_log(s->avctx, AV_LOG_DEBUG, "dynrange: %i\n", s->dynrange);
776 av_log(s->avctx, AV_LOG_DEBUG, "timestamp: %i\n", s->timestamp);774 av_log(s->avctx, AV_LOG_DEBUG, "timestamp: %i\n", s->timestamp);
777 av_log(s->avctx, AV_LOG_DEBUG, "aux_data: %i\n", s->aux_data);775 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
956 954
957 /* Stereo downmix coefficients */955 /* Stereo downmix coefficients */
958 if (!base_channel && s->prim_channels > 2) {956 if (!base_channel && s->prim_channels > 2) {
959 if (s->downmix) {957 int am = s->amode & DCA_CHANNEL_MASK;
960 for (j = base_channel; j < s->prim_channels; j++) {958 if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) {
961 s->downmix_coef[j][0] = dca_downmix_coeffs[get_bits(&s->gb, 7)];959 av_log(s->avctx, AV_LOG_ERROR,
962 s->downmix_coef[j][1] = dca_downmix_coeffs[get_bits(&s->gb, 7)];960 "Invalid channel mode %d\n", am);
963 }961 return AVERROR_INVALIDDATA;
964 } else {962 }
965 int am = s->amode & DCA_CHANNEL_MASK;963 if (s->prim_channels > FF_ARRAY_ELEMS(dca_default_coeffs[0])) {
966 if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) {964 avpriv_request_sample(s->avctx, "Downmixing %d channels",
967 av_log(s->avctx, AV_LOG_ERROR,965 s->prim_channels);
968 "Invalid channel mode %d\n", am);966 return AVERROR_PATCHWELCOME;
969 return AVERROR_INVALIDDATA;967 }
970 }968 for (j = base_channel; j < s->prim_channels; j++) {
971 if (s->prim_channels > FF_ARRAY_ELEMS(dca_default_coeffs[0])) {969 s->downmix_coef[j][0] = dca_default_coeffs[am][j][0];
972 avpriv_request_sample(s->avctx, "Downmixing %d channels",970 s->downmix_coef[j][1] = dca_default_coeffs[am][j][1];
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 }
981 }971 }
982 }972 }
983 973
@@ -1080,7 +1070,7 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) · 96 unmodified lines
1080 av_log(s->avctx, AV_LOG_DEBUG, "\n");1070 av_log(s->avctx, AV_LOG_DEBUG, "\n");
1081 }1071 }
1082 }1072 }
1083 if (!base_channel && s->prim_channels > 2 && s->downmix) {1073 if (!base_channel && s->prim_channels > 2) {
1084 av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n");1074 av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n");
1085 for (j = 0; j < s->prim_channels; j++) {1075 for (j = 0; j < s->prim_channels; j++) {
1086 av_log(s->avctx, AV_LOG_DEBUG, "Channel 0, %d = %f\n", j,1076 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
1480 for (i = 0; i < aux_data_count; i++)1470 for (i = 0; i < aux_data_count; i++)
1481 get_bits(&s->gb, 8);1471 get_bits(&s->gb, 8);
1482 1472
1483 if (s->crc_present && (s->downmix || s->dynrange))1473 if (s->crc_present && s->dynrange)
1484 get_bits(&s->gb, 16);1474 get_bits(&s->gb, 16);
1485 }1475 }
1486 1476

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