aaccoder: remove previous PNS implementation from twoloop
This commit undoes commit c5d4f87e81
and removes PNS band marking from the twoloop coder, which has
been reimplemented in a better way in this series of patches.
Reviewed-by: Claudio Freire <klaussfreire@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:

committed by
Michael Niedermayer

parent
e06578e392
commit
117b15f4a8
@@ -792,11 +792,9 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
|||||||
{
|
{
|
||||||
int start = 0, i, w, w2, g;
|
int start = 0, i, w, w2, g;
|
||||||
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
|
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
|
||||||
const float freq_mult = avctx->sample_rate/(1024.0f/sce->ics.num_windows)/2.0f;
|
|
||||||
float dists[128] = { 0 }, uplims[128] = { 0 };
|
float dists[128] = { 0 }, uplims[128] = { 0 };
|
||||||
float maxvals[128];
|
float maxvals[128];
|
||||||
int noise_sf[128] = { 0 };
|
int fflag, minscaler;
|
||||||
int fflag, minscaler, minscaler_n;
|
|
||||||
int its = 0;
|
int its = 0;
|
||||||
int allz = 0;
|
int allz = 0;
|
||||||
float minthr = INFINITY;
|
float minthr = INFINITY;
|
||||||
@@ -807,7 +805,6 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
|||||||
//XXX: some heuristic to determine initial quantizers will reduce search time
|
//XXX: some heuristic to determine initial quantizers will reduce search time
|
||||||
//determine zero bands and upper limits
|
//determine zero bands and upper limits
|
||||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||||
start = 0;
|
|
||||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||||
int nz = 0;
|
int nz = 0;
|
||||||
float uplim = 0.0f, energy = 0.0f;
|
float uplim = 0.0f, energy = 0.0f;
|
||||||
@@ -822,18 +819,10 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
|||||||
nz = 1;
|
nz = 1;
|
||||||
}
|
}
|
||||||
uplims[w*16+g] = uplim *512;
|
uplims[w*16+g] = uplim *512;
|
||||||
if (s->options.pns && start*freq_mult > NOISE_LOW_LIMIT && energy < uplim * 1.2f) {
|
|
||||||
noise_sf[w*16+g] = av_clip(4+FFMIN(log2f(energy)*2,255), -100, 155);
|
|
||||||
sce->band_type[w*16+g] = NOISE_BT;
|
|
||||||
nz= 1;
|
|
||||||
} else { /** Band type will be determined by the twoloop algorithm */
|
|
||||||
sce->band_type[w*16+g] = 0;
|
|
||||||
}
|
|
||||||
sce->zeroes[w*16+g] = !nz;
|
sce->zeroes[w*16+g] = !nz;
|
||||||
if (nz)
|
if (nz)
|
||||||
minthr = FFMIN(minthr, uplim);
|
minthr = FFMIN(minthr, uplim);
|
||||||
allz |= nz;
|
allz |= nz;
|
||||||
start += sce->ics.swb_sizes[g];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||||
@@ -864,7 +853,6 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
|||||||
do {
|
do {
|
||||||
int tbits, qstep;
|
int tbits, qstep;
|
||||||
minscaler = sce->sf_idx[0];
|
minscaler = sce->sf_idx[0];
|
||||||
minscaler_n = sce->sf_idx[0];
|
|
||||||
//inner loop - quantize spectrum to fit into given number of bits
|
//inner loop - quantize spectrum to fit into given number of bits
|
||||||
qstep = its ? 1 : 32;
|
qstep = its ? 1 : 32;
|
||||||
do {
|
do {
|
||||||
@@ -879,11 +867,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
|||||||
int cb;
|
int cb;
|
||||||
float dist = 0.0f;
|
float dist = 0.0f;
|
||||||
|
|
||||||
if (sce->band_type[w*16+g] == NOISE_BT) {
|
if (sce->zeroes[w*16+g] || sce->sf_idx[w*16+g] >= 218) {
|
||||||
minscaler_n = FFMIN(minscaler_n, noise_sf[w*16+g]);
|
|
||||||
start += sce->ics.swb_sizes[g];
|
|
||||||
continue;
|
|
||||||
} else if (sce->zeroes[w*16+g] || sce->sf_idx[w*16+g] >= 218) {
|
|
||||||
start += sce->ics.swb_sizes[g];
|
start += sce->ics.swb_sizes[g];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -927,16 +911,9 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
|||||||
fflag = 0;
|
fflag = 0;
|
||||||
minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF);
|
minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF);
|
||||||
|
|
||||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w])
|
|
||||||
for (g = 0; g < sce->ics.num_swb; g++)
|
|
||||||
if (sce->band_type[w*16+g] == NOISE_BT)
|
|
||||||
sce->sf_idx[w*16+g] = av_clip(noise_sf[w*16+g], minscaler_n, minscaler_n + SCALE_MAX_DIFF);
|
|
||||||
|
|
||||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||||
int prevsc = sce->sf_idx[w*16+g];
|
int prevsc = sce->sf_idx[w*16+g];
|
||||||
if (sce->band_type[w*16+g] == NOISE_BT)
|
|
||||||
continue;
|
|
||||||
if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) {
|
if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) {
|
||||||
if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1))
|
if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1))
|
||||||
sce->sf_idx[w*16+g]--;
|
sce->sf_idx[w*16+g]--;
|
||||||
|
Reference in New Issue
Block a user