X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fac3enc.h;h=be9dcf21c149f329867fadabede733d0cf554bfb;hb=62514ca012c8b0d30c291fc6e58c0de7b452cd89;hp=2647204d14485bc4295ed1d43b6936fc3cfb9a1d;hpb=3a1df52e3ce70f41c4f8b9900be2c2907b7e21ef;p=ffmpeg diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h index 2647204d144..be9dcf21c14 100644 --- a/libavcodec/ac3enc.h +++ b/libavcodec/ac3enc.h @@ -29,6 +29,8 @@ #define AVCODEC_AC3ENC_H #include + +#include "libavutil/float_dsp.h" #include "ac3.h" #include "ac3dsp.h" #include "avcodec.h" @@ -52,6 +54,7 @@ #define MAC_COEF(d,a,b) ((d)+=(a)*(b)) #define COEF_MIN (-16777215.0/16777216.0) #define COEF_MAX ( 16777215.0/16777216.0) +#define NEW_CPL_COORD_THRESHOLD 0.03 typedef float SampleType; typedef float CoefType; typedef float CoefSumType; @@ -60,13 +63,30 @@ typedef float CoefSumType; #define MAC_COEF(d,a,b) MAC64(d,a,b) #define COEF_MIN -16777215 #define COEF_MAX 16777215 +#define NEW_CPL_COORD_THRESHOLD 503317 typedef int16_t SampleType; typedef int32_t CoefType; typedef int64_t CoefSumType; #endif +/* common option values */ +#define AC3ENC_OPT_NONE -1 +#define AC3ENC_OPT_AUTO -1 +#define AC3ENC_OPT_OFF 0 +#define AC3ENC_OPT_ON 1 +#define AC3ENC_OPT_NOT_INDICATED 0 +#define AC3ENC_OPT_MODE_ON 2 +#define AC3ENC_OPT_MODE_OFF 1 + +/* specific option values */ +#define AC3ENC_OPT_LARGE_ROOM 1 +#define AC3ENC_OPT_SMALL_ROOM 2 +#define AC3ENC_OPT_DOWNMIX_LTRT 1 +#define AC3ENC_OPT_DOWNMIX_LORO 2 +#define AC3ENC_OPT_ADCONV_STANDARD 0 +#define AC3ENC_OPT_ADCONV_HDCD 1 + -#if 0 /** * Encoding Options used by AVOption. */ @@ -101,7 +121,7 @@ typedef struct AC3EncOptions { int channel_coupling; int cpl_start; } AC3EncOptions; -#endif + /** * Data for a single audio block. */ @@ -124,7 +144,7 @@ typedef struct AC3Block { int cpl_in_use; ///< coupling in use for this block (cplinu) uint8_t channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl) int num_cpl_channels; ///< number of channels in coupling - uint8_t new_cpl_coords; ///< send new coupling coordinates (cplcoe) + uint8_t new_cpl_coords[AC3_MAX_CHANNELS]; ///< send new coupling coordinates (cplcoe) uint8_t cpl_master_exp[AC3_MAX_CHANNELS]; ///< coupling coord master exponents (mstrcplco) int new_snr_offsets; ///< send new SNR offsets int new_cpl_leak; ///< send new coupling leak info @@ -140,6 +160,7 @@ typedef struct AC3EncodeContext { AVCodecContext *avctx; ///< parent AVCodecContext PutBitContext pb; ///< bitstream writer context DSPContext dsp; + AVFloatDSPContext fdsp; AC3DSPContext ac3dsp; ///< AC-3 optimized functions FFTContext mdct; ///< FFT context for MDCT calculation const SampleType *mdct_window; ///< MDCT window function array @@ -240,6 +261,8 @@ typedef struct AC3EncodeContext { } AC3EncodeContext; +extern const uint64_t ff_ac3_channel_layouts[19]; + int ff_ac3_encode_init(AVCodecContext *avctx); int ff_ac3_encode_close(AVCodecContext *avctx); @@ -256,6 +279,8 @@ void ff_ac3_process_exponents(AC3EncodeContext *s); int ff_ac3_compute_bit_allocation(AC3EncodeContext *s); +void ff_ac3_group_exponents(AC3EncodeContext *s); + void ff_ac3_quantize_mantissas(AC3EncodeContext *s); void ff_ac3_output_frame(AC3EncodeContext *s, unsigned char *frame); @@ -275,9 +300,9 @@ int ff_ac3_float_mdct_init(AC3EncodeContext *s); int ff_ac3_fixed_allocate_sample_buffers(AC3EncodeContext *s); int ff_ac3_float_allocate_sample_buffers(AC3EncodeContext *s); -int ff_ac3_fixed_encode_frame(AVCodecContext *avctx, unsigned char *frame, - int buf_size, void *data); -int ff_ac3_float_encode_frame(AVCodecContext *avctx, unsigned char *frame, - int buf_size, void *data); +int ff_ac3_fixed_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); +int ff_ac3_float_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); #endif /* AVCODEC_AC3ENC_H */