diff options
author | Rodeo <[email protected]> | 2012-08-02 21:43:22 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2012-08-02 21:43:22 +0000 |
commit | b3717d369763d620d548f224daeba5a7503fa972 (patch) | |
tree | 4742e9b49e03db2b1c558e10f40c2c821528e8f5 /libhb/common.c | |
parent | ad257c9dac38fe3f7502b1058247b4458465c0a8 (diff) |
Use hb_audio_resample for downmixing AC3 sources. DRC is still applied by liba52.
Add support for center & surround mix levels to hb_audio_resample.
This allows us to support upmixing all audio sources. For sources that have at least 2 front and one back or side channel(s), allow upmixing to 5.1:
3.0/3.1 (2 front and 1 back channels)
4.0/4.1 (3 front and 1 back channels)
4.0/4.1 (2 front and 2 side channels)
5.0 (3 front and 2 side channels)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4885 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/common.c')
-rw-r--r-- | libhb/common.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/libhb/common.c b/libhb/common.c index 9ff9f44a3..6315498cc 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -722,43 +722,36 @@ int hb_get_best_mixdown(uint32_t codec, uint64_t layout, int mixdown) // Audio passthrough, no mixdown return HB_AMIXDOWN_NONE; } - else if ((layout & AV_CH_LAYOUT_5POINT1) == AV_CH_LAYOUT_5POINT1 || - (layout & AV_CH_LAYOUT_5POINT1_BACK) == AV_CH_LAYOUT_5POINT1_BACK) + else if ((layout & AV_CH_LAYOUT_2_1) == AV_CH_LAYOUT_2_1 || + (layout & AV_CH_LAYOUT_2_2) == AV_CH_LAYOUT_2_2 || + (layout & AV_CH_LAYOUT_QUAD) == AV_CH_LAYOUT_QUAD) { - // full 3F2R, possibly with additional channels, and an LFE - // limiting factor: liba52, libdca (can't upmix) - if (codec == HB_ACODEC_LAME || codec == HB_ACODEC_FFAAC) + // at least 2 front channels and one back or side channel + // allow downmixing or upmixing to 5.1 (yes, we can) + if (codec != HB_ACODEC_LAME && codec != HB_ACODEC_FFAAC) { - best_mixdown = HB_AMIXDOWN_DOLBYPLII; + best_mixdown = HB_AMIXDOWN_6CH; } else { - best_mixdown = HB_AMIXDOWN_6CH; + best_mixdown = HB_AMIXDOWN_DOLBYPLII; } } - else if ((layout & AV_CH_LAYOUT_5POINT0) == AV_CH_LAYOUT_5POINT0 || - (layout & AV_CH_LAYOUT_5POINT0_BACK) == AV_CH_LAYOUT_5POINT0_BACK) + else if (layout == AV_CH_LAYOUT_STEREO_DOWNMIX) { - // full 3F2R, possibly with additional channels, but no LFE - // limiting factor: liba52, libdca (can't upmix) - // limiting factor: libdca (can only do DPL2 with 3F2R sources) - best_mixdown = HB_AMIXDOWN_DOLBYPLII; + // Dolby in, allow Dolby out + best_mixdown = HB_AMIXDOWN_DOLBY; } - else if(layout == AV_CH_LAYOUT_STEREO) + else if (av_get_channel_layout_nb_channels(layout) > 1) { - // limiting factor: no Dolby Surround for Stereo sources + // more than one channel, allow Stereo downmix best_mixdown = HB_AMIXDOWN_STEREO; } - else if(av_get_channel_layout_nb_channels(layout) == 1) + else { // only one channel, not much point in upmixing best_mixdown = HB_AMIXDOWN_MONO; } - else - { - // everything else, including Dolby (AV_CH_LAYOUT_STEREO_DOWNMIX) - best_mixdown = HB_AMIXDOWN_DOLBY; - } // return the best that is not greater than the requested mixdown // HB_INVALID_AMIXDOWN means the caller requested the best available mixdown @@ -773,7 +766,7 @@ int hb_get_default_mixdown(uint32_t codec, uint64_t layout) int mixdown; switch (codec) { - // the AC3 encoder defaults to the best mixdown up to 6-channel + // the FLAC and AC3 encoders default to the best mixdown up to 6-channel case HB_ACODEC_FFFLAC: case HB_ACODEC_AC3: mixdown = HB_AMIXDOWN_6CH; |