private bool balance_noise(LameGlobalFlags gfp, GrInfo cod_info, float[] distort, float[] xrpow, bool bRefine) { var gfc = gfp.internal_flags; amp_scalefac_bands(gfp, cod_info, distort, xrpow, bRefine); var status = loop_break(cod_info); if (status) { return(false); } if (gfc.mode_gr == 2) { status = tk.scale_bitcount(cod_info); } else { status = tk.scale_bitcount_lsf(gfc, cod_info); } if (!status) { return(true); } if (gfc.noise_shaping > 1) { Arrays.Fill(gfc.pseudohalf, 0); if (0 == cod_info.scalefac_scale) { inc_scalefac_scale(cod_info, xrpow); status = false; } else { if (cod_info.block_type == Encoder.SHORT_TYPE && gfc.subblock_gain > 0) { status = inc_subblock_gain(gfc, cod_info, xrpow) || loop_break(cod_info); } } } if (!status) { if (gfc.mode_gr == 2) { status = tk.scale_bitcount(cod_info); } else { status = tk.scale_bitcount_lsf(gfc, cod_info); } } return(!status); }
private void bitcount(algo_t that) { bool rc; if (that.gfc.mode_gr == 2) { rc = tak.scale_bitcount(that.cod_info); } else { rc = tak.scale_bitcount_lsf(that.gfc, that.cod_info); } if (!rc) { return; } /* this should not happen due to the way the scalefactors are selected */ throw new Exception("INTERNAL ERROR IN VBR NEW CODE (986), please send bug report"); }