mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
cosmetics: change FlacEncodeContext variable name from ctx to s in several
places for consistency. Originally committed as revision 24602 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
871a24f3bf
commit
15f537ed53
@ -791,7 +791,7 @@ static void encode_residual_lpc(int32_t *res, const int32_t *smp, int n,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int encode_residual(FlacEncodeContext *ctx, int ch)
|
static int encode_residual(FlacEncodeContext *s, int ch)
|
||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
int min_order, max_order, opt_order, precision, omethod;
|
int min_order, max_order, opt_order, precision, omethod;
|
||||||
@ -802,7 +802,7 @@ static int encode_residual(FlacEncodeContext *ctx, int ch)
|
|||||||
int shift[MAX_LPC_ORDER];
|
int shift[MAX_LPC_ORDER];
|
||||||
int32_t *res, *smp;
|
int32_t *res, *smp;
|
||||||
|
|
||||||
frame = &ctx->frame;
|
frame = &s->frame;
|
||||||
sub = &frame->subframes[ch];
|
sub = &frame->subframes[ch];
|
||||||
res = sub->residual;
|
res = sub->residual;
|
||||||
smp = sub->samples;
|
smp = sub->samples;
|
||||||
@ -825,16 +825,16 @@ static int encode_residual(FlacEncodeContext *ctx, int ch)
|
|||||||
return sub->obits * n;
|
return sub->obits * n;
|
||||||
}
|
}
|
||||||
|
|
||||||
min_order = ctx->options.min_prediction_order;
|
min_order = s->options.min_prediction_order;
|
||||||
max_order = ctx->options.max_prediction_order;
|
max_order = s->options.max_prediction_order;
|
||||||
min_porder = ctx->options.min_partition_order;
|
min_porder = s->options.min_partition_order;
|
||||||
max_porder = ctx->options.max_partition_order;
|
max_porder = s->options.max_partition_order;
|
||||||
precision = ctx->options.lpc_coeff_precision;
|
precision = s->options.lpc_coeff_precision;
|
||||||
omethod = ctx->options.prediction_order_method;
|
omethod = s->options.prediction_order_method;
|
||||||
|
|
||||||
/* FIXED */
|
/* FIXED */
|
||||||
if (ctx->options.lpc_type == AV_LPC_TYPE_NONE ||
|
if (s->options.lpc_type == AV_LPC_TYPE_NONE ||
|
||||||
ctx->options.lpc_type == AV_LPC_TYPE_FIXED || n <= max_order) {
|
s->options.lpc_type == AV_LPC_TYPE_FIXED || n <= max_order) {
|
||||||
uint32_t bits[MAX_FIXED_ORDER+1];
|
uint32_t bits[MAX_FIXED_ORDER+1];
|
||||||
if (max_order > MAX_FIXED_ORDER)
|
if (max_order > MAX_FIXED_ORDER)
|
||||||
max_order = MAX_FIXED_ORDER;
|
max_order = MAX_FIXED_ORDER;
|
||||||
@ -859,9 +859,9 @@ static int encode_residual(FlacEncodeContext *ctx, int ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* LPC */
|
/* LPC */
|
||||||
opt_order = ff_lpc_calc_coefs(&ctx->dsp, smp, n, min_order, max_order,
|
opt_order = ff_lpc_calc_coefs(&s->dsp, smp, n, min_order, max_order,
|
||||||
precision, coefs, shift, ctx->options.lpc_type,
|
precision, coefs, shift, s->options.lpc_type,
|
||||||
ctx->options.lpc_passes, omethod,
|
s->options.lpc_passes, omethod,
|
||||||
MAX_LPC_SHIFT, 0);
|
MAX_LPC_SHIFT, 0);
|
||||||
|
|
||||||
if (omethod == ORDER_METHOD_2LEVEL ||
|
if (omethod == ORDER_METHOD_2LEVEL ||
|
||||||
@ -936,14 +936,14 @@ static int encode_residual(FlacEncodeContext *ctx, int ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int encode_residual_v(FlacEncodeContext *ctx, int ch)
|
static int encode_residual_v(FlacEncodeContext *s, int ch)
|
||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
FlacFrame *frame;
|
FlacFrame *frame;
|
||||||
FlacSubframe *sub;
|
FlacSubframe *sub;
|
||||||
int32_t *res, *smp;
|
int32_t *res, *smp;
|
||||||
|
|
||||||
frame = &ctx->frame;
|
frame = &s->frame;
|
||||||
sub = &frame->subframes[ch];
|
sub = &frame->subframes[ch];
|
||||||
res = sub->residual;
|
res = sub->residual;
|
||||||
smp = sub->samples;
|
smp = sub->samples;
|
||||||
@ -1016,18 +1016,18 @@ static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
|
|||||||
/**
|
/**
|
||||||
* Perform stereo channel decorrelation.
|
* Perform stereo channel decorrelation.
|
||||||
*/
|
*/
|
||||||
static void channel_decorrelation(FlacEncodeContext *ctx)
|
static void channel_decorrelation(FlacEncodeContext *s)
|
||||||
{
|
{
|
||||||
FlacFrame *frame;
|
FlacFrame *frame;
|
||||||
int32_t *left, *right;
|
int32_t *left, *right;
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
frame = &ctx->frame;
|
frame = &s->frame;
|
||||||
n = frame->blocksize;
|
n = frame->blocksize;
|
||||||
left = frame->subframes[0].samples;
|
left = frame->subframes[0].samples;
|
||||||
right = frame->subframes[1].samples;
|
right = frame->subframes[1].samples;
|
||||||
|
|
||||||
if (ctx->channels != 2) {
|
if (s->channels != 2) {
|
||||||
frame->ch_mode = FLAC_CHMODE_INDEPENDENT;
|
frame->ch_mode = FLAC_CHMODE_INDEPENDENT;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1129,7 +1129,7 @@ static void output_subframe_verbatim(FlacEncodeContext *s, int ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void output_residual(FlacEncodeContext *ctx, int ch)
|
static void output_residual(FlacEncodeContext *s, int ch)
|
||||||
{
|
{
|
||||||
int i, j, p, n, parts;
|
int i, j, p, n, parts;
|
||||||
int k, porder, psize, res_cnt;
|
int k, porder, psize, res_cnt;
|
||||||
@ -1137,74 +1137,74 @@ static void output_residual(FlacEncodeContext *ctx, int ch)
|
|||||||
FlacSubframe *sub;
|
FlacSubframe *sub;
|
||||||
int32_t *res;
|
int32_t *res;
|
||||||
|
|
||||||
frame = &ctx->frame;
|
frame = &s->frame;
|
||||||
sub = &frame->subframes[ch];
|
sub = &frame->subframes[ch];
|
||||||
res = sub->residual;
|
res = sub->residual;
|
||||||
n = frame->blocksize;
|
n = frame->blocksize;
|
||||||
|
|
||||||
/* rice-encoded block */
|
/* rice-encoded block */
|
||||||
put_bits(&ctx->pb, 2, 0);
|
put_bits(&s->pb, 2, 0);
|
||||||
|
|
||||||
/* partition order */
|
/* partition order */
|
||||||
porder = sub->rc.porder;
|
porder = sub->rc.porder;
|
||||||
psize = n >> porder;
|
psize = n >> porder;
|
||||||
parts = (1 << porder);
|
parts = (1 << porder);
|
||||||
put_bits(&ctx->pb, 4, porder);
|
put_bits(&s->pb, 4, porder);
|
||||||
res_cnt = psize - sub->order;
|
res_cnt = psize - sub->order;
|
||||||
|
|
||||||
/* residual */
|
/* residual */
|
||||||
j = sub->order;
|
j = sub->order;
|
||||||
for (p = 0; p < parts; p++) {
|
for (p = 0; p < parts; p++) {
|
||||||
k = sub->rc.params[p];
|
k = sub->rc.params[p];
|
||||||
put_bits(&ctx->pb, 4, k);
|
put_bits(&s->pb, 4, k);
|
||||||
if (p == 1)
|
if (p == 1)
|
||||||
res_cnt = psize;
|
res_cnt = psize;
|
||||||
for (i = 0; i < res_cnt && j < n; i++, j++)
|
for (i = 0; i < res_cnt && j < n; i++, j++)
|
||||||
set_sr_golomb_flac(&ctx->pb, res[j], k, INT32_MAX, 0);
|
set_sr_golomb_flac(&s->pb, res[j], k, INT32_MAX, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void output_subframe_fixed(FlacEncodeContext *ctx, int ch)
|
static void output_subframe_fixed(FlacEncodeContext *s, int ch)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
FlacFrame *frame;
|
FlacFrame *frame;
|
||||||
FlacSubframe *sub;
|
FlacSubframe *sub;
|
||||||
|
|
||||||
frame = &ctx->frame;
|
frame = &s->frame;
|
||||||
sub = &frame->subframes[ch];
|
sub = &frame->subframes[ch];
|
||||||
|
|
||||||
/* warm-up samples */
|
/* warm-up samples */
|
||||||
for (i = 0; i < sub->order; i++)
|
for (i = 0; i < sub->order; i++)
|
||||||
put_sbits(&ctx->pb, sub->obits, sub->residual[i]);
|
put_sbits(&s->pb, sub->obits, sub->residual[i]);
|
||||||
|
|
||||||
/* residual */
|
/* residual */
|
||||||
output_residual(ctx, ch);
|
output_residual(s, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void output_subframe_lpc(FlacEncodeContext *ctx, int ch)
|
static void output_subframe_lpc(FlacEncodeContext *s, int ch)
|
||||||
{
|
{
|
||||||
int i, cbits;
|
int i, cbits;
|
||||||
FlacFrame *frame;
|
FlacFrame *frame;
|
||||||
FlacSubframe *sub;
|
FlacSubframe *sub;
|
||||||
|
|
||||||
frame = &ctx->frame;
|
frame = &s->frame;
|
||||||
sub = &frame->subframes[ch];
|
sub = &frame->subframes[ch];
|
||||||
|
|
||||||
/* warm-up samples */
|
/* warm-up samples */
|
||||||
for (i = 0; i < sub->order; i++)
|
for (i = 0; i < sub->order; i++)
|
||||||
put_sbits(&ctx->pb, sub->obits, sub->residual[i]);
|
put_sbits(&s->pb, sub->obits, sub->residual[i]);
|
||||||
|
|
||||||
/* LPC coefficients */
|
/* LPC coefficients */
|
||||||
cbits = ctx->options.lpc_coeff_precision;
|
cbits = s->options.lpc_coeff_precision;
|
||||||
put_bits( &ctx->pb, 4, cbits-1);
|
put_bits( &s->pb, 4, cbits-1);
|
||||||
put_sbits(&ctx->pb, 5, sub->shift);
|
put_sbits(&s->pb, 5, sub->shift);
|
||||||
for (i = 0; i < sub->order; i++)
|
for (i = 0; i < sub->order; i++)
|
||||||
put_sbits(&ctx->pb, cbits, sub->coefs[i]);
|
put_sbits(&s->pb, cbits, sub->coefs[i]);
|
||||||
|
|
||||||
/* residual */
|
/* residual */
|
||||||
output_residual(ctx, ch);
|
output_residual(s, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user