2
0

ac3dec_float.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * AC-3 Audio Decoder
  3. * This code was developed as part of Google Summer of Code 2006.
  4. * E-AC-3 support was added as part of Google Summer of Code 2007.
  5. *
  6. * Copyright (c) 2006 Kartikey Mahendra BHATT (bhattkm at gmail dot com)
  7. * Copyright (c) 2007-2008 Bartlomiej Wolowiec <bartek.wolowiec@gmail.com>
  8. * Copyright (c) 2007 Justin Ruggles <justin.ruggles@gmail.com>
  9. *
  10. * This file is part of FFmpeg.
  11. *
  12. * FFmpeg is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU Lesser General Public
  14. * License as published by the Free Software Foundation; either
  15. * version 2.1 of the License, or (at your option) any later version.
  16. *
  17. * FFmpeg is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * Lesser General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Lesser General Public
  23. * License along with FFmpeg; if not, write to the Free Software
  24. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  25. */
  26. /**
  27. * Upmix delay samples from stereo to original channel layout.
  28. */
  29. #include "ac3dec.h"
  30. #include "eac3dec.c"
  31. #include "ac3dec.c"
  32. static const AVOption options[] = {
  33. { "cons_noisegen", "enable consistent noise generation", OFFSET(consistent_noise_generation), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, PAR },
  34. { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR },
  35. { "heavy_compr", "enable heavy dynamic range compression", OFFSET(heavy_compression), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, PAR },
  36. { "target_level", "target level in -dBFS (0 not applied)", OFFSET(target_level), AV_OPT_TYPE_INT, {.i64 = 0 }, -31, 0, PAR },
  37. {"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 2, 0, "dmix_mode"},
  38. {"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
  39. {"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
  40. {"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
  41. {"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
  42. { NULL},
  43. };
  44. static const AVClass ac3_decoder_class = {
  45. .class_name = "AC3 decoder",
  46. .item_name = av_default_item_name,
  47. .option = options,
  48. .version = LIBAVUTIL_VERSION_INT,
  49. };
  50. AVCodec ff_ac3_decoder = {
  51. .name = "ac3",
  52. .type = AVMEDIA_TYPE_AUDIO,
  53. .id = AV_CODEC_ID_AC3,
  54. .priv_data_size = sizeof (AC3DecodeContext),
  55. .init = ac3_decode_init,
  56. .close = ac3_decode_end,
  57. .decode = ac3_decode_frame,
  58. .capabilities = AV_CODEC_CAP_DR1,
  59. .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
  60. .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
  61. AV_SAMPLE_FMT_NONE },
  62. .priv_class = &ac3_decoder_class,
  63. };
  64. #if CONFIG_EAC3_DECODER
  65. static const AVClass eac3_decoder_class = {
  66. .class_name = "E-AC3 decoder",
  67. .item_name = av_default_item_name,
  68. .option = options,
  69. .version = LIBAVUTIL_VERSION_INT,
  70. };
  71. AVCodec ff_eac3_decoder = {
  72. .name = "eac3",
  73. .type = AVMEDIA_TYPE_AUDIO,
  74. .id = AV_CODEC_ID_EAC3,
  75. .priv_data_size = sizeof (AC3DecodeContext),
  76. .init = ac3_decode_init,
  77. .close = ac3_decode_end,
  78. .decode = ac3_decode_frame,
  79. .capabilities = AV_CODEC_CAP_DR1,
  80. .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
  81. .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
  82. AV_SAMPLE_FMT_NONE },
  83. .priv_class = &eac3_decoder_class,
  84. };
  85. #endif