FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
flacenc.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/intmath.h"
#include "libavutil/md5.h"
#include "libavutil/mem.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, shift0)
 
#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
 

Macro Definition Documentation

◆ FLAC_SUBFRAME_CONSTANT

#define FLAC_SUBFRAME_CONSTANT   0

Definition at line 40 of file flacenc.c.

◆ FLAC_SUBFRAME_VERBATIM

#define FLAC_SUBFRAME_VERBATIM   1

Definition at line 41 of file flacenc.c.

◆ FLAC_SUBFRAME_FIXED

#define FLAC_SUBFRAME_FIXED   8

Definition at line 42 of file flacenc.c.

◆ FLAC_SUBFRAME_LPC

#define FLAC_SUBFRAME_LPC   32

Definition at line 43 of file flacenc.c.

◆ MAX_FIXED_ORDER

#define MAX_FIXED_ORDER   4

Definition at line 45 of file flacenc.c.

◆ MAX_PARTITION_ORDER

#define MAX_PARTITION_ORDER   8

Definition at line 46 of file flacenc.c.

◆ MAX_PARTITIONS

#define MAX_PARTITIONS   (1 << MAX_PARTITION_ORDER)

Definition at line 47 of file flacenc.c.

◆ MAX_LPC_PRECISION

#define MAX_LPC_PRECISION   15

Definition at line 48 of file flacenc.c.

◆ MIN_LPC_SHIFT

#define MIN_LPC_SHIFT   0

Definition at line 49 of file flacenc.c.

◆ MAX_LPC_SHIFT

#define MAX_LPC_SHIFT   15

Definition at line 50 of file flacenc.c.

◆ COPY_SAMPLES

#define COPY_SAMPLES (   bits,
  shift0 
)
Value:
do { \
const int ## bits ## _t *samples0 = samples; \
const int shift = shift0; \
frame = &s->frame; \
for (i = 0, j = 0; i < frame->blocksize; i++) \
for (ch = 0; ch < s->channels; ch++, j++) \
frame->subframes[ch].samples[i] = samples0[j] >> shift; \
} while (0)

◆ rice_encode_count

#define rice_encode_count (   sum,
  n,
 
)    (((n)*((k)+1))+((sum-(n>>1))>>(k)))

Definition at line 608 of file flacenc.c.

◆ ENCODE_RESIDUAL_FIXED_WITH_RESIDUAL_LIMIT

#define ENCODE_RESIDUAL_FIXED_WITH_RESIDUAL_LIMIT ( )

Definition at line 834 of file flacenc.c.

◆ LPC_ENCODE_WITH_RESIDUAL_LIMIT

#define LPC_ENCODE_WITH_RESIDUAL_LIMIT ( )
Value:
{ \
for (int i = 0; i < order; i++) \
res[i] = smp[i]; \
for (int i = order; i < len; i++) { \
int64_t p = 0, tmp; \
for (int j = 0; j < order; j++) \
p += (int64_t)coefs[j]*smp[(i-1)-j]; \
p >>= shift; \
tmp = smp[i] - p; \
if (tmp <= INT32_MIN || tmp > INT32_MAX) \
return 1; \
res[i] = tmp; \
} \
return 0; \
}

Definition at line 889 of file flacenc.c.

◆ DEFAULT_TO_VERBATIM

#define DEFAULT_TO_VERBATIM ( )
Value:
{ \
sub->type = sub->type_code = FLAC_SUBFRAME_VERBATIM; \
if (sub->obits <= 32) \
memcpy(res, smp, n * sizeof(int32_t)); \
return subframe_count_exact(s, sub, 0); \
}

Definition at line 945 of file flacenc.c.

◆ FLAGS

Definition at line 1712 of file flacenc.c.

Enumeration Type Documentation

◆ CodingMode

enum CodingMode
Enumerator
CODING_MODE_RICE 
CODING_MODE_RICE2 

Definition at line 52 of file flacenc.c.

Function Documentation

◆ write_streaminfo()

static void write_streaminfo ( FlacEncodeContext s,
uint8_t *  header 
)
static

Write streaminfo metadata block to byte array.

Definition at line 138 of file flacenc.c.

Referenced by flac_encode_frame(), and flac_encode_init().

◆ flac_get_max_frame_size()

static int flac_get_max_frame_size ( int  blocksize,
int  ch,
int  bps 
)
static

Calculate an estimate for the maximum frame size based on verbatim mode.

Parameters
blocksizeblock size, in samples
chnumber of channels
bpsbits-per-sample

Definition at line 167 of file flacenc.c.

Referenced by flac_encode_frame(), and flac_encode_init().

◆ select_blocksize()

static int select_blocksize ( int  samplerate,
int  block_time_ms 
)
static

Set blocksize based on samplerate.

Choose the closest predefined blocksize >= BLOCK_TIME_MS milliseconds.

Definition at line 193 of file flacenc.c.

Referenced by flac_encode_init().

◆ dprint_compression_options()

static av_cold void dprint_compression_options ( FlacEncodeContext s)
static

Definition at line 212 of file flacenc.c.

Referenced by flac_encode_init().

◆ flac_encode_init()

static av_cold int flac_encode_init ( AVCodecContext avctx)
static

Definition at line 270 of file flacenc.c.

◆ init_frame()

static void init_frame ( FlacEncodeContext s,
int  nb_samples 
)
static

Definition at line 479 of file flacenc.c.

Referenced by decode_frame(), and flac_encode_frame().

◆ copy_samples()

static void copy_samples ( FlacEncodeContext s,
const void *  samples 
)
static

Copy channel-interleaved input samples into separate subframes.

Definition at line 524 of file flacenc.c.

Referenced by flac_encode_frame().

◆ rice_count_exact()

static uint64_t rice_count_exact ( const int32_t res,
int  n,
int  k 
)
static

Definition at line 545 of file flacenc.c.

Referenced by subframe_count_exact().

◆ subframe_count_exact()

static uint64_t subframe_count_exact ( FlacEncodeContext s,
FlacSubframe sub,
int  pred_order 
)
static

Definition at line 558 of file flacenc.c.

Referenced by encode_residual_ch().

◆ find_optimal_param()

static int find_optimal_param ( uint64_t  sum,
int  n,
int  max_param 
)
static

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().

◆ find_optimal_param_exact()

static int find_optimal_param_exact ( uint64_t  sums[32][MAX_PARTITIONS],
int  i,
int  max_param 
)
static

Definition at line 625 of file flacenc.c.

Referenced by calc_optimal_rice_params().

◆ calc_optimal_rice_params()

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

Definition at line 642 of file flacenc.c.

Referenced by calc_rice_params().

◆ calc_sum_top()

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

Definition at line 672 of file flacenc.c.

Referenced by calc_rice_params().

◆ calc_sum_next()

static void calc_sum_next ( int  level,
uint64_t  sums[32][MAX_PARTITIONS],
int  kmax 
)
static

Definition at line 702 of file flacenc.c.

Referenced by calc_rice_params().

◆ calc_rice_params()

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

Definition at line 712 of file flacenc.c.

Referenced by find_subframe_rice_params().

◆ get_max_p_order()

static int get_max_p_order ( int  max_porder,
int  n,
int  order 
)
static

Definition at line 752 of file flacenc.c.

Referenced by find_subframe_rice_params().

◆ find_subframe_rice_params()

static uint64_t find_subframe_rice_params ( FlacEncodeContext s,
FlacSubframe sub,
int  pred_order 
)
static

Definition at line 761 of file flacenc.c.

Referenced by encode_residual_ch().

◆ encode_residual_fixed()

static void encode_residual_fixed ( int32_t res,
const int32_t smp,
int  n,
int  order 
)
static

Definition at line 778 of file flacenc.c.

Referenced by encode_residual_ch().

◆ encode_residual_fixed_with_residual_limit()

static int encode_residual_fixed_with_residual_limit ( int32_t res,
const int32_t smp,
int  n,
int  order 
)
static

Definition at line 876 of file flacenc.c.

Referenced by encode_residual_ch().

◆ encode_residual_fixed_with_residual_limit_33bps()

static int encode_residual_fixed_with_residual_limit_33bps ( int32_t res,
const int64_t smp,
int  n,
int  order 
)
static

Definition at line 883 of file flacenc.c.

Referenced by encode_residual_ch().

◆ lpc_encode_with_residual_limit()

static int lpc_encode_with_residual_limit ( int32_t res,
const int32_t smp,
int  len,
int  order,
int32_t coefs,
int  shift 
)
static

Definition at line 906 of file flacenc.c.

Referenced by lpc_encode_choose_datapath().

◆ lpc_encode_with_residual_limit_33bps()

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

Definition at line 912 of file flacenc.c.

Referenced by lpc_encode_choose_datapath().

◆ lpc_encode_choose_datapath()

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

Definition at line 918 of file flacenc.c.

Referenced by encode_residual_ch().

◆ encode_residual_ch()

static int encode_residual_ch ( FlacEncodeContext s,
int  ch 
)
static

Definition at line 953 of file flacenc.c.

Referenced by encode_frame().

◆ count_frame_header()

static int count_frame_header ( FlacEncodeContext s)
static

Definition at line 1173 of file flacenc.c.

Referenced by encode_frame().

◆ encode_frame()

static int encode_frame ( FlacEncodeContext s)
static

Definition at line 1209 of file flacenc.c.

Referenced by flac_encode_frame().

◆ remove_wasted_bits()

static void remove_wasted_bits ( FlacEncodeContext s)
static

Definition at line 1229 of file flacenc.c.

Referenced by flac_encode_frame().

◆ estimate_stereo_mode()

static int estimate_stereo_mode ( const int32_t left_ch,
const int32_t right_ch,
int  n,
int  max_rice_param,
int  bps 
)
static

Definition at line 1283 of file flacenc.c.

Referenced by channel_decorrelation().

◆ channel_decorrelation()

static void channel_decorrelation ( FlacEncodeContext s)
static

Perform stereo channel decorrelation.

Definition at line 1339 of file flacenc.c.

Referenced by flac_encode_frame().

◆ write_utf8()

static void write_utf8 ( PutBitContext pb,
uint32_t  val 
)
static

Definition at line 1406 of file flacenc.c.

Referenced by write_frame_header().

◆ write_frame_header()

static void write_frame_header ( FlacEncodeContext s)
static

Definition at line 1413 of file flacenc.c.

Referenced by write_frame().

◆ set_sr_golomb_flac()

static void set_sr_golomb_flac ( PutBitContext pb,
int  i,
int  k 
)
inlinestatic

Definition at line 1450 of file flacenc.c.

Referenced by write_subframes().

◆ write_subframes()

static void write_subframes ( FlacEncodeContext s)
static

Definition at line 1469 of file flacenc.c.

Referenced by write_frame().

◆ write_frame_footer()

static void write_frame_footer ( FlacEncodeContext s)
static

Definition at line 1553 of file flacenc.c.

Referenced by write_frame().

◆ write_frame()

static int write_frame ( FlacEncodeContext s,
AVPacket avpkt 
)
static

Definition at line 1564 of file flacenc.c.

Referenced by flac_encode_frame().

◆ update_md5_sum()

static int update_md5_sum ( FlacEncodeContext s,
const void *  samples 
)
static

Definition at line 1574 of file flacenc.c.

Referenced by flac_encode_frame().

◆ flac_encode_frame()

static int flac_encode_frame ( AVCodecContext avctx,
AVPacket avpkt,
const AVFrame frame,
int *  got_packet_ptr 
)
static

Definition at line 1619 of file flacenc.c.

◆ flac_encode_close()

static av_cold int flac_encode_close ( AVCodecContext avctx)
static

Definition at line 1702 of file flacenc.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "lpc_coeff_precision", "LPC coefficient precision", 0x42, AV_OPT_TYPE_INT, {.i64 = 15 }, 0, MAX_LPC_PRECISION, FLAGS },
{ "lpc_type", "LPC algorithm", 0x42, AV_OPT_TYPE_INT, {.i64 = FF_LPC_TYPE_DEFAULT }, FF_LPC_TYPE_DEFAULT, FF_LPC_TYPE_NB-1, FLAGS, .unit = "lpc_type" },
{ "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LPC_TYPE_NONE }, INT_MIN, INT_MAX, FLAGS, .unit = "lpc_type" },
{ "fixed", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LPC_TYPE_FIXED }, INT_MIN, INT_MAX, FLAGS, .unit = "lpc_type" },
{ "levinson", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LPC_TYPE_LEVINSON }, INT_MIN, INT_MAX, FLAGS, .unit = "lpc_type" },
{ "cholesky", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LPC_TYPE_CHOLESKY }, INT_MIN, INT_MAX, FLAGS, .unit = "lpc_type" },
{ "lpc_passes", "Number of passes to use for Cholesky factorization during LPC analysis", 0x42, AV_OPT_TYPE_INT, {.i64 = 2 }, 1, INT_MAX, FLAGS },
{ "min_partition_order", NULL, 0x42, AV_OPT_TYPE_INT, {.i64 = -1 }, -1, MAX_PARTITION_ORDER, FLAGS },
{ "max_partition_order", NULL, 0x42, AV_OPT_TYPE_INT, {.i64 = -1 }, -1, MAX_PARTITION_ORDER, FLAGS },
{ "prediction_order_method", "Search method for selecting prediction order", 0x42, AV_OPT_TYPE_INT, {.i64 = -1 }, -1, ORDER_METHOD_LOG, FLAGS, .unit = "predm" },
{ "estimation", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_EST }, INT_MIN, INT_MAX, FLAGS, .unit = "predm" },
{ "2level", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_2LEVEL }, INT_MIN, INT_MAX, FLAGS, .unit = "predm" },
{ "4level", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_4LEVEL }, INT_MIN, INT_MAX, FLAGS, .unit = "predm" },
{ "8level", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_8LEVEL }, INT_MIN, INT_MAX, FLAGS, .unit = "predm" },
{ "search", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_SEARCH }, INT_MIN, INT_MAX, FLAGS, .unit = "predm" },
{ "log", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_LOG }, INT_MIN, INT_MAX, FLAGS, .unit = "predm" },
{ "ch_mode", "Stereo decorrelation mode", 0x42, AV_OPT_TYPE_INT, { .i64 = -1 }, -1, FLAC_CHMODE_MID_SIDE, FLAGS, .unit = "ch_mode" },
{ "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, INT_MAX, FLAGS, .unit = "ch_mode" },
{ "indep", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_INDEPENDENT }, INT_MIN, INT_MAX, FLAGS, .unit = "ch_mode" },
{ "left_side", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_LEFT_SIDE }, INT_MIN, INT_MAX, FLAGS, .unit = "ch_mode" },
{ "right_side", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_RIGHT_SIDE }, INT_MIN, INT_MAX, FLAGS, .unit = "ch_mode" },
{ "mid_side", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_MID_SIDE }, INT_MIN, INT_MAX, FLAGS, .unit = "ch_mode" },
{ "exact_rice_parameters", "Calculate rice parameters exactly", 0x42, AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ "multi_dim_quant", "Multi-dimensional quantization", 0x42, AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ "min_prediction_order", NULL, 0x42, AV_OPT_TYPE_INT, { .i64 = -1 }, -1, MAX_LPC_ORDER, FLAGS },
{ "max_prediction_order", NULL, 0x42, AV_OPT_TYPE_INT, { .i64 = -1 }, -1, MAX_LPC_ORDER, FLAGS },
{ NULL },
}

Definition at line 1713 of file flacenc.c.

◆ flac_encoder_class

const AVClass flac_encoder_class
static
Initial value:
= {
.class_name = "FLAC encoder",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 1744 of file flacenc.c.

◆ ff_flac_encoder

const FFCodec ff_flac_encoder
Initial value:

Definition at line 1751 of file flacenc.c.

FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
flac_encode_init
static av_cold int flac_encode_init(AVCodecContext *avctx)
Definition: flacenc.c:270
MAX_PARTITION_ORDER
#define MAX_PARTITION_ORDER
Definition: flacenc.c:46
FF_CODEC_CAP_EOF_FLUSH
#define FF_CODEC_CAP_EOF_FLUSH
The encoder has AV_CODEC_CAP_DELAY set, but does not actually have delay - it only wants to be flushe...
Definition: codec_internal.h:90
int64_t
long long int64_t
Definition: coverity.c:34
flac_encode_frame
static int flac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: flacenc.c:1619
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
FF_LPC_TYPE_CHOLESKY
@ FF_LPC_TYPE_CHOLESKY
Cholesky factorization.
Definition: lpc.h:47
FlacEncodeContext
Definition: flacenc.c:106
FLAC_CHMODE_MID_SIDE
@ FLAC_CHMODE_MID_SIDE
Definition: flac.h:42
AV_CODEC_ID_FLAC
@ AV_CODEC_ID_FLAC
Definition: codec_id.h:458
FLAC_CHMODE_RIGHT_SIDE
@ FLAC_CHMODE_RIGHT_SIDE
Definition: flac.h:41
ORDER_METHOD_4LEVEL
#define ORDER_METHOD_4LEVEL
Definition: lpc.h:31
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:320
FF_LPC_TYPE_DEFAULT
@ FF_LPC_TYPE_DEFAULT
use the codec default LPC type
Definition: lpc.h:43
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
bits
uint8_t bits
Definition: vp3data.h:128
FLAC_SUBFRAME_VERBATIM
#define FLAC_SUBFRAME_VERBATIM
Definition: flacenc.c:41
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
FLAGS
#define FLAGS
Definition: flacenc.c:1712
FLAC_CHMODE_LEFT_SIDE
@ FLAC_CHMODE_LEFT_SIDE
Definition: flac.h:40
ORDER_METHOD_SEARCH
#define ORDER_METHOD_SEARCH
Definition: lpc.h:33
ORDER_METHOD_8LEVEL
#define ORDER_METHOD_8LEVEL
Definition: lpc.h:32
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
shift
static int shift(int a, int b)
Definition: bonk.c:261
FF_LPC_TYPE_NB
@ FF_LPC_TYPE_NB
Not part of ABI.
Definition: lpc.h:48
MAX_LPC_ORDER
#define MAX_LPC_ORDER
Definition: lpc.h:37
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
ORDER_METHOD_EST
#define ORDER_METHOD_EST
Definition: lpc.h:29
options
static const AVOption options[]
Definition: flacenc.c:1713
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
len
int len
Definition: vorbis_enc_data.h:426
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
MAX_LPC_PRECISION
#define MAX_LPC_PRECISION
Definition: flacenc.c:48
ORDER_METHOD_LOG
#define ORDER_METHOD_LOG
Definition: lpc.h:34
subframe_count_exact
static uint64_t subframe_count_exact(FlacEncodeContext *s, FlacSubframe *sub, int pred_order)
Definition: flacenc.c:558
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AV_CODEC_CAP_DELAY
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:76
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
FLAC_CHMODE_INDEPENDENT
@ FLAC_CHMODE_INDEPENDENT
Definition: flac.h:39
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
flac_encode_close
static av_cold int flac_encode_close(AVCodecContext *avctx)
Definition: flacenc.c:1702
int32_t
int32_t
Definition: audioconvert.c:56
flac_encoder_class
static const AVClass flac_encoder_class
Definition: flacenc.c:1744
ORDER_METHOD_2LEVEL
#define ORDER_METHOD_2LEVEL
Definition: lpc.h:30
FF_LPC_TYPE_NONE
@ FF_LPC_TYPE_NONE
do not use LPC prediction or use all zero coefficients
Definition: lpc.h:44
AV_CODEC_CAP_SMALL_LAST_FRAME
#define AV_CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
Definition: codec.h:81
AV_SAMPLE_FMT_S32
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:59
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
FF_LPC_TYPE_LEVINSON
@ FF_LPC_TYPE_LEVINSON
Levinson-Durbin recursion.
Definition: lpc.h:46
FF_LPC_TYPE_FIXED
@ FF_LPC_TYPE_FIXED
fixed LPC coefficients
Definition: lpc.h:45