Level 3: Fix alpha miss-calculation that affected SNR
This commit is contained in:
@@ -485,46 +485,16 @@ def aac_coder_3(
|
||||
sfc_L_dpcm = np.asarray(sfc_L, dtype=np.int64)[1:, ...]
|
||||
sfc_R_dpcm = np.asarray(sfc_R, dtype=np.int64)[1:, ...]
|
||||
|
||||
# Codebook 11:
|
||||
# maxAbsCodeVal = 16 is RESERVED for ESCAPE.
|
||||
# We must stay strictly within [-15, +15] to avoid escape decoding.
|
||||
# sf_cb = 11
|
||||
# sf_max_abs = int(huff_LUT_list[sf_cb]["maxAbsCodeVal"]) - 1 # -> 15
|
||||
#
|
||||
# sfc_L_dpcm = np.clip(
|
||||
# sfc_L_dpcm,
|
||||
# -sf_max_abs,
|
||||
# sf_max_abs,
|
||||
# ).astype(np.int64, copy=False)
|
||||
#
|
||||
# sfc_R_dpcm = np.clip(
|
||||
# sfc_R_dpcm,
|
||||
# -sf_max_abs,
|
||||
# sf_max_abs,
|
||||
# ).astype(np.int64, copy=False)
|
||||
|
||||
sfc_L_stream, cb_sfc_L = aac_encode_huff(
|
||||
sfc_L_dpcm.reshape(-1, order="F"),
|
||||
huff_LUT_list,
|
||||
# force_codebook=11,
|
||||
)
|
||||
sfc_R_stream, cb_sfc_R = aac_encode_huff(
|
||||
sfc_R_dpcm.reshape(-1, order="F"),
|
||||
huff_LUT_list,
|
||||
# force_codebook=11,
|
||||
)
|
||||
# sfc_L_stream, cb_sfc_L = aac_encode_huff(sfc_L_dpcm.reshape(-1, order="F"), huff_LUT_list, force_codebook=11)
|
||||
# sfc_R_stream, cb_sfc_R = aac_encode_huff(sfc_R_dpcm.reshape(-1, order="F"), huff_LUT_list, force_codebook=11)
|
||||
sfc_L_stream, cb_sfc_L = aac_encode_huff(sfc_L_dpcm.reshape(-1, order="F"), huff_LUT_list)
|
||||
sfc_R_stream, cb_sfc_R = aac_encode_huff(sfc_R_dpcm.reshape(-1, order="F"), huff_LUT_list)
|
||||
|
||||
if cb_sfc_L != 11 or cb_sfc_R != 11:
|
||||
print (f"frame: {i}: cb_sfc_l={cb_sfc_L}, cb_sfc_r={cb_sfc_R}")
|
||||
raise ValueError(f"Illegal codebook value for frame: {i}: cb_sfc_l={cb_sfc_L}, cb_sfc_r={cb_sfc_R}.")
|
||||
|
||||
mdct_L_stream, cb_L = aac_encode_huff(
|
||||
np.asarray(S_L, dtype=np.int64).reshape(-1),
|
||||
huff_LUT_list,
|
||||
)
|
||||
mdct_R_stream, cb_R = aac_encode_huff(
|
||||
np.asarray(S_R, dtype=np.int64).reshape(-1),
|
||||
huff_LUT_list,
|
||||
)
|
||||
mdct_L_stream, cb_L = aac_encode_huff(np.asarray(S_L, dtype=np.int64).reshape(-1), huff_LUT_list)
|
||||
mdct_R_stream, cb_R = aac_encode_huff(np.asarray(S_R, dtype=np.int64).reshape(-1), huff_LUT_list)
|
||||
|
||||
# Typed dict construction helps static analyzers validate the schema.
|
||||
frame_out: AACSeq3Frame = {
|
||||
|
||||
Reference in New Issue
Block a user