📄 ac3dec_exponents.cpp
字号:
/* ////////////////////////// ac3dec_exponents.cpp ////////////////////////// *//*//// INTeL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright (c) 2003-2005 Intel Corporation. All Rights Reserved.//*/#include "umc_ac3_decoder.h"#include "ac3dec_tables.h"int UMC::AC3Decoder::DecodeExponents(int nblk){ int i; Ipp32u cbErrors = 0; for (i = 0; i < bsi.nfchans; i++) { cbErrors += expUnpackCh(CH_FBW, audblk[nblk]->chexpstr[i], audblk[nblk]->nchgrps[i], audblk[nblk]->exps[i][0], &audblk[nblk]->exps[i][1], &audblk[nblk]->fbw_exp[i][0]); } if (audblk[nblk]->cplinu) { cbErrors += expUnpackCh(CH_CPL, audblk[nblk]->cplexpstr, audblk[nblk]->ncplgrps, (Ipp16u)(audblk[nblk]->cplabsexp << 1), &audblk[nblk]->cplexps[0], &audblk[nblk]->cpl_exp[audblk[nblk]->cplstrtmant]); } if (bsi.lfeon) { cbErrors += expUnpackCh(CH_LFE, audblk[nblk]->lfeexpstr, 2, audblk[nblk]->lfeexps[0], &audblk[nblk]->lfeexps[1], &audblk[nblk]->lfe_exp[0]); } return cbErrors; /* return # unpacking errors */}int UMC::AC3Decoder::expUnpackCh(Ipp16u TypeCh, Ipp16u ExpStr, Ipp16u nGrps, Ipp16u Exp0, Ipp16u *source, Ipp16u *dest){ Ipp16u i, j; Ipp16s exp_acc; Ipp32u cbErrors = 0; /* error counter */ short pkexp = 0; if (ExpStr == EXP_REUSE) return cbErrors;/* * Handle the initial absolute exponent */ exp_acc = Exp0; j = 0;/* * In the case of a fbw channel then the initial absolute values is also an * exponent */ if (TypeCh != CH_CPL) { dest[j++] = exp_acc; }/* * Loop through the groups and fill the dest array appropriately */ for (i = 0; i < nGrps; i++) { if (source[i] > 124) // FIXME set an error flag and mute the frame { ++cbErrors; continue; // do not update current exponent } pkexp = source[i]; pkexp = UNGRP5[pkexp]; exp_acc = (((pkexp >> 12) & 0x000f) - 2) + exp_acc; switch (ExpStr) { case EXP_D45: dest[j++] = exp_acc; dest[j++] = exp_acc; case EXP_D25: dest[j++] = exp_acc; case EXP_D15: dest[j++] = exp_acc; } exp_acc = (((pkexp >> 8) & 0x000f) - 2) + exp_acc; switch (ExpStr) { case EXP_D45: dest[j++] = exp_acc; dest[j++] = exp_acc; case EXP_D25: dest[j++] = exp_acc; case EXP_D15: dest[j++] = exp_acc; } exp_acc = (((pkexp >> 4) & 0x000f) - 2) + exp_acc; switch (ExpStr) { case EXP_D45: dest[j++] = exp_acc; dest[j++] = exp_acc; case EXP_D25: dest[j++] = exp_acc; case EXP_D15: dest[j++] = exp_acc; } } return cbErrors; /* return # exponent unpacking errors */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -