FFmpeg
|
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/intmath.h"
#include "libavutil/md5.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bswapdsp.h"
#include "codec_internal.h"
#include "encode.h"
#include "put_bits.h"
#include "lpc.h"
#include "flac.h"
#include "flacdata.h"
#include "flacencdsp.h"
Go to the source code of this file.
Data Structures | |
struct | CompressionOptions |
struct | RiceContext |
struct | FlacSubframe |
struct | FlacFrame |
struct | FlacEncodeContext |
Macros | |
#define | FLAC_SUBFRAME_CONSTANT 0 |
#define | FLAC_SUBFRAME_VERBATIM 1 |
#define | FLAC_SUBFRAME_FIXED 8 |
#define | FLAC_SUBFRAME_LPC 32 |
#define | MAX_FIXED_ORDER 4 |
#define | MAX_PARTITION_ORDER 8 |
#define | MAX_PARTITIONS (1 << MAX_PARTITION_ORDER) |
#define | MAX_LPC_PRECISION 15 |
#define | MIN_LPC_SHIFT 0 |
#define | MAX_LPC_SHIFT 15 |
#define | COPY_SAMPLES(bits) |
#define | rice_encode_count(sum, n, k) (((n)*((k)+1))+((sum-(n>>1))>>(k))) |
#define | ENCODE_RESIDUAL_FIXED_WITH_RESIDUAL_LIMIT() |
#define | LPC_ENCODE_WITH_RESIDUAL_LIMIT() |
#define | DEFAULT_TO_VERBATIM() |
#define | FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM |
Enumerations | |
enum | CodingMode { CODING_MODE_RICE = 4, CODING_MODE_RICE2 = 5 } |
Functions | |
static void | write_streaminfo (FlacEncodeContext *s, uint8_t *header) |
Write streaminfo metadata block to byte array. More... | |
static int | flac_get_max_frame_size (int blocksize, int ch, int bps) |
Calculate an estimate for the maximum frame size based on verbatim mode. More... | |
static int | select_blocksize (int samplerate, int block_time_ms) |
Set blocksize based on samplerate. More... | |
static av_cold void | dprint_compression_options (FlacEncodeContext *s) |
static av_cold int | flac_encode_init (AVCodecContext *avctx) |
static void | init_frame (FlacEncodeContext *s, int nb_samples) |
static void | copy_samples (FlacEncodeContext *s, const void *samples) |
Copy channel-interleaved input samples into separate subframes. More... | |
static uint64_t | rice_count_exact (const int32_t *res, int n, int k) |
static uint64_t | subframe_count_exact (FlacEncodeContext *s, FlacSubframe *sub, int pred_order) |
static int | find_optimal_param (uint64_t sum, int n, int max_param) |
Solve for d/dk(rice_encode_count) = n-((sum-(n>>1))>>(k+1)) = 0. More... | |
static int | find_optimal_param_exact (uint64_t sums[32][MAX_PARTITIONS], int i, int max_param) |
static uint64_t | calc_optimal_rice_params (RiceContext *rc, int porder, uint64_t sums[32][MAX_PARTITIONS], int n, int pred_order, int max_param, int exact) |
static void | calc_sum_top (int pmax, int kmax, const uint32_t *data, int n, int pred_order, uint64_t sums[32][MAX_PARTITIONS]) |
static void | calc_sum_next (int level, uint64_t sums[32][MAX_PARTITIONS], int kmax) |
static uint64_t | calc_rice_params (RiceContext *rc, uint32_t udata[FLAC_MAX_BLOCKSIZE], uint64_t sums[32][MAX_PARTITIONS], int pmin, int pmax, const int32_t *data, int n, int pred_order, int exact) |
static int | get_max_p_order (int max_porder, int n, int order) |
static uint64_t | find_subframe_rice_params (FlacEncodeContext *s, FlacSubframe *sub, int pred_order) |
static void | encode_residual_fixed (int32_t *res, const int32_t *smp, int n, int order) |
static int | encode_residual_fixed_with_residual_limit (int32_t *res, const int32_t *smp, int n, int order) |
static int | encode_residual_fixed_with_residual_limit_33bps (int32_t *res, const int64_t *smp, int n, int order) |
static int | lpc_encode_with_residual_limit (int32_t *res, const int32_t *smp, int len, int order, int32_t *coefs, int shift) |
static int | lpc_encode_with_residual_limit_33bps (int32_t *res, const int64_t *smp, int len, int order, int32_t *coefs, int shift) |
static int | lpc_encode_choose_datapath (FlacEncodeContext *s, int32_t bps, int32_t *res, const int32_t *smp, const int64_t *smp_33bps, int len, int order, int32_t *coefs, int shift) |
static int | encode_residual_ch (FlacEncodeContext *s, int ch) |
static int | count_frame_header (FlacEncodeContext *s) |
static int | encode_frame (FlacEncodeContext *s) |
static void | remove_wasted_bits (FlacEncodeContext *s) |
static int | estimate_stereo_mode (const int32_t *left_ch, const int32_t *right_ch, int n, int max_rice_param, int bps) |
static void | channel_decorrelation (FlacEncodeContext *s) |
Perform stereo channel decorrelation. More... | |
static void | write_utf8 (PutBitContext *pb, uint32_t val) |
static void | write_frame_header (FlacEncodeContext *s) |
static void | set_sr_golomb_flac (PutBitContext *pb, int i, int k) |
static void | write_subframes (FlacEncodeContext *s) |
static void | write_frame_footer (FlacEncodeContext *s) |
static int | write_frame (FlacEncodeContext *s, AVPacket *avpkt) |
static int | update_md5_sum (FlacEncodeContext *s, const void *samples) |
static int | flac_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) |
static av_cold int | flac_encode_close (AVCodecContext *avctx) |
Variables | |
static const AVOption | options [] |
static const AVClass | flac_encoder_class |
const FFCodec | ff_flac_encoder |
#define MAX_PARTITIONS (1 << MAX_PARTITION_ORDER) |
#define COPY_SAMPLES | ( | bits | ) |
#define rice_encode_count | ( | sum, | |
n, | |||
k | |||
) | (((n)*((k)+1))+((sum-(n>>1))>>(k))) |
#define LPC_ENCODE_WITH_RESIDUAL_LIMIT | ( | ) |
#define DEFAULT_TO_VERBATIM | ( | ) |
#define FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM |
enum CodingMode |
|
static |
Write streaminfo metadata block to byte array.
Definition at line 137 of file flacenc.c.
Referenced by flac_encode_frame(), and flac_encode_init().
Calculate an estimate for the maximum frame size based on verbatim mode.
blocksize | block size, in samples |
ch | number of channels |
bps | bits-per-sample |
Definition at line 166 of file flacenc.c.
Referenced by flac_encode_frame(), and flac_encode_init().
Set blocksize based on samplerate.
Choose the closest predefined blocksize >= BLOCK_TIME_MS milliseconds.
Definition at line 192 of file flacenc.c.
Referenced by flac_encode_init().
|
static |
Definition at line 211 of file flacenc.c.
Referenced by flac_encode_init().
|
static |
|
static |
Definition at line 478 of file flacenc.c.
Referenced by decode_frame(), and flac_encode_frame().
|
static |
Copy channel-interleaved input samples into separate subframes.
Definition at line 523 of file flacenc.c.
Referenced by flac_encode_frame().
Definition at line 545 of file flacenc.c.
Referenced by subframe_count_exact().
|
static |
Definition at line 558 of file flacenc.c.
Referenced by encode_residual_ch().
Solve for d/dk(rice_encode_count) = n-((sum-(n>>1))>>(k+1)) = 0.
Definition at line 613 of file flacenc.c.
Referenced by calc_optimal_rice_params(), and estimate_stereo_mode().
|
static |
Definition at line 625 of file flacenc.c.
Referenced by calc_optimal_rice_params().
|
static |
Definition at line 642 of file flacenc.c.
Referenced by calc_rice_params().
|
static |
Definition at line 672 of file flacenc.c.
Referenced by calc_rice_params().
Definition at line 702 of file flacenc.c.
Referenced by calc_rice_params().
|
static |
Definition at line 712 of file flacenc.c.
Referenced by find_subframe_rice_params().
Definition at line 752 of file flacenc.c.
Referenced by find_subframe_rice_params().
|
static |
Definition at line 761 of file flacenc.c.
Referenced by encode_residual_ch().
Definition at line 778 of file flacenc.c.
Referenced by encode_residual_ch().
|
static |
Definition at line 876 of file flacenc.c.
Referenced by encode_residual_ch().
|
static |
Definition at line 883 of file flacenc.c.
Referenced by encode_residual_ch().
|
static |
Definition at line 906 of file flacenc.c.
Referenced by lpc_encode_choose_datapath().
|
static |
Definition at line 912 of file flacenc.c.
Referenced by lpc_encode_choose_datapath().
|
static |
Definition at line 918 of file flacenc.c.
Referenced by encode_residual_ch().
|
static |
Definition at line 953 of file flacenc.c.
Referenced by encode_frame().
|
static |
Definition at line 1173 of file flacenc.c.
Referenced by encode_frame().
|
static |
Definition at line 1209 of file flacenc.c.
Referenced by flac_encode_frame().
|
static |
Definition at line 1229 of file flacenc.c.
Referenced by flac_encode_frame().
|
static |
Definition at line 1283 of file flacenc.c.
Referenced by channel_decorrelation().
|
static |
Perform stereo channel decorrelation.
Definition at line 1339 of file flacenc.c.
Referenced by flac_encode_frame().
|
static |
Definition at line 1406 of file flacenc.c.
Referenced by write_frame_header().
|
static |
Definition at line 1413 of file flacenc.c.
Referenced by write_frame().
|
inlinestatic |
Definition at line 1450 of file flacenc.c.
Referenced by write_subframes().
|
static |
Definition at line 1469 of file flacenc.c.
Referenced by write_frame().
|
static |
Definition at line 1553 of file flacenc.c.
Referenced by write_frame().
|
static |
Definition at line 1564 of file flacenc.c.
Referenced by flac_encode_frame().
|
static |
Definition at line 1574 of file flacenc.c.
Referenced by flac_encode_frame().
|
static |
|
static |
|
static |
|
static |
const FFCodec ff_flac_encoder |