• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/minidlna/ffmpeg-2.3.4/libavcodec/

Lines Matching refs:chctx

84     IMCChannel chctx[2];
192 q->chctx[j].decoder_reset = 1;
195 q->chctx[j].old_floor[i] = 1.0;
198 q->chctx[j].last_fft_im[i] = 0;
432 static int bit_allocation(IMCContext *q, IMCChannel *chctx,
452 highest = FFMAX(highest, chctx->flcoeffs1[i]);
455 if (chctx->flcoeffs5[i] <= 0) {
456 av_log(NULL, AV_LOG_ERROR, "flcoeffs5 %f invalid\n", chctx->flcoeffs5[i]);
459 chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log2f(chctx->flcoeffs5[i]);
461 chctx->flcoeffs4[BANDS - 1] = limit;
467 if ((band_tab[i + 1] - band_tab[i]) == chctx->bandWidthT[i])
470 if ((band_tab[i + 1] - band_tab[i]) > chctx->bandWidthT[i])
473 if (((band_tab[i + 1] - band_tab[i]) / 2) >= chctx->bandWidthT[i])
479 chctx->flcoeffs4[i] += xTab[(indx * 2 + (chctx->flcoeffs1[i] < highest)) * 2 + flag];
483 chctx->flcoeffs4[0] = limit;
484 chctx->flcoeffs4[1] = limit;
485 chctx->flcoeffs4[2] = limit;
486 chctx->flcoeffs4[3] = limit;
490 iacc += chctx->bandWidthT[i];
491 summa += chctx->bandWidthT[i] * chctx->flcoeffs4[i];
497 chctx->bandWidthT[BANDS - 1] = 0;
510 cwlen = av_clipf(((chctx->flcoeffs4[j] * 0.5) - summa + 0.5), 0, 6);
512 chctx->bitsBandT[j] = cwlen;
513 summer += chctx->bandWidthT[j] * cwlen;
516 iacc += chctx->bandWidthT[j];
533 chctx->CWlengthT[j] = chctx->bitsBandT[i];
538 workT[i] = (chctx->bitsBandT[i] == 6) ? -1.e20
539 : (chctx->bitsBandT[i] * -2 + chctx->flcoeffs4[i] - 0.415);
560 if (++chctx->bitsBandT[found_indx] == 6)
564 chctx->CWlengthT[j]++;
572 workT[i] = chctx->bitsBandT[i] ? (chctx->bitsBandT[i] * -2 + chctx->flcoeffs4[i] + 1.585)
594 if (!--chctx->bitsBandT[low_indx])
598 if (chctx->CWlengthT[j] > 0) {
599 chctx->CWlengthT[j]--;
608 static void imc_get_skip_coeff(IMCContext *q, IMCChannel *chctx)
612 memset(chctx->skipFlagBits, 0, sizeof(chctx->skipFlagBits));
613 memset(chctx->skipFlagCount, 0, sizeof(chctx->skipFlagCount));
615 if (!chctx->bandFlagsBuf[i] || !chctx->bandWidthT[i])
618 if (!chctx->skipFlagRaw[i]) {
619 chctx->skipFlagBits[i] = band_tab[i + 1] - band_tab[i];
622 chctx->skipFlags[j] = get_bits1(&q->gb);
623 if (chctx->skipFlags[j])
624 chctx->skipFlagCount[i]++;
629 chctx->skipFlagBits[i]++;
630 chctx->skipFlags[j] = 1;
631 chctx->skipFlags[j + 1] = 1;
632 chctx->skipFlagCount[i] += 2;
635 chctx->skipFlagBits[i] += 2;
636 chctx->skipFlags[j] = 0;
637 chctx->skipFlags[j + 1] = 1;
638 chctx->skipFlagCount[i]++;
640 chctx->skipFlagBits[i] += 3;
641 chctx->skipFlags[j + 1] = 0;
643 chctx->skipFlags[j] = 1;
644 chctx->skipFlagCount[i]++;
646 chctx->skipFlags[j] = 0;
653 chctx->skipFlagBits[i]++;
654 if ((chctx->skipFlags[j] = get_bits1(&q->gb)))
655 chctx->skipFlagCount[i]++;
664 static void imc_adjust_bit_allocation(IMCContext *q, IMCChannel *chctx,
674 workT[i] = (chctx->bitsBandT[i] == 6) ? -1.e20
675 : (chctx->bitsBandT[i] * -2 + chctx->flcoeffs4[i] - 0.415);
693 if (++(chctx->bitsBandT[found_indx]) == 6)
697 if (!chctx->skipFlags[j] && (chctx->CWlengthT[j] < 6)) {
698 chctx->CWlengthT[j]++;
706 static void imc_imdct256(IMCContext *q, IMCChannel *chctx, int channels)
715 q->samples[i].re = -(q->pre_coef1[i] * chctx->CWdecoded[COEFFS - 1 - i * 2]) -
716 (q->pre_coef2[i] * chctx->CWdecoded[i * 2]);
717 q->samples[i].im = (q->pre_coef2[i] * chctx->CWdecoded[COEFFS - 1 - i * 2]) -
718 (q->pre_coef1[i] * chctx->CWdecoded[i * 2]);
729 *dst1 = (q->mdct_sine_window[COEFFS - 1 - i * 2] * chctx->last_fft_im[i])
731 *dst2 = (q->mdct_sine_window[i * 2] * chctx->last_fft_im[i])
735 chctx->last_fft_im[i] = im;
739 static int inverse_quant_coeff(IMCContext *q, IMCChannel *chctx,
748 chctx->CWdecoded[j] = 0;
749 cw_len = chctx->CWlengthT[j];
751 if (cw_len <= 0 || chctx->skipFlags[j])
757 if (chctx->codewords[j] >= max_size || chctx->codewords[j] < 0)
762 if (chctx->codewords[j] >= middle_value)
763 chctx->CWdecoded[j] = quantizer[chctx->codewords[j] - 8] * chctx->flcoeffs6[i];
765 chctx->CWdecoded[j] = -quantizer[max_size - chctx->codewords[j] - 8 - 1] * chctx->flcoeffs6[i];
767 quantizer = imc_quantizer1[((stream_format_code & 2) >> 1) | (chctx->bandFlagsBuf[i] << 1)];
768 if (chctx->codewords[j] >= middle_value)
769 chctx->CWdecoded[j] = quantizer[chctx->codewords[j] - 1] * chctx->flcoeffs6[i];
771 chctx->CWdecoded[j] = -quantizer[max_size - 2 - chctx->codewords[j]] * chctx->flcoeffs6[i];
779 static int imc_get_coeffs(IMCContext *q, IMCChannel *chctx)
784 if (!chctx->sumLenArr[i])
786 if (chctx->bandFlagsBuf[i] || chctx->bandWidthT[i]) {
788 cw_len = chctx->CWlengthT[j];
796 if (cw_len && (!chctx->bandFlagsBuf[i] || !chctx->skipFlags[j]))
799 chctx->codewords[j] = cw;
806 static void imc_refine_bit_allocation(IMCContext *q, IMCChannel *chctx)
812 chctx->sumLenArr[i] = 0;
813 chctx->skipFlagRaw[i] = 0;
815 chctx->sumLenArr[i] += chctx->CWlengthT[j];
816 if (chctx->bandFlagsBuf[i])
817 if ((((band_tab[i + 1] - band_tab[i]) * 1.5) > chctx->sumLenArr[i]) && (chctx->sumLenArr[i] > 0))
818 chctx->skipFlagRaw[i] = 1;
821 imc_get_skip_coeff(q, chctx);
824 chctx->flcoeffs6[i] = chctx->flcoeffs1[i];
826 if (chctx->bandFlagsBuf[i] && (band_tab[i + 1] - band_tab[i]) != chctx->skipFlagCount[i]) {
827 chctx->flcoeffs6[i] *= q->sqrt_tab[ band_tab[i + 1] - band_tab[i]] /
828 q->sqrt_tab[(band_tab[i + 1] - band_tab[i] - chctx->skipFlagCount[i])];
836 if (chctx->bandFlagsBuf[i]) {
838 if (chctx->skipFlags[j]) {
839 summer += chctx->CWlengthT[j];
840 chctx->CWlengthT[j] = 0;
843 bits += chctx->skipFlagBits[i];
844 summer -= chctx->skipFlagBits[i];
847 imc_adjust_bit_allocation(q, chctx, summer);
857 IMCChannel *chctx = q->chctx + ch;
870 chctx->decoder_reset = 1;
872 if (chctx->decoder_reset) {
874 chctx->old_floor[i] = 1.0;
876 chctx->CWdecoded[i] = 0;
877 chctx->decoder_reset = 0;
882 imc_decode_level_coefficients_raw(q, chctx->levlCoeffBuf,
883 chctx->flcoeffs1, chctx->flcoeffs2);
885 imc_read_level_coeffs_raw(q, stream_format_code, chctx->levlCoeffBuf);
887 imc_read_level_coeffs(q, stream_format_code, chctx->levlCoeffBuf);
890 imc_decode_level_coefficients(q, chctx->levlCoeffBuf,
891 chctx->flcoeffs1, chctx->flcoeffs2);
893 imc_decode_level_coefficients2(q, chctx->levlCoeffBuf, chctx->old_floor,
894 chctx->flcoeffs1, chctx->flcoeffs2);
897 if(chctx->flcoeffs1[i] > INT_MAX) {
903 memcpy(chctx->old_floor, chctx->flcoeffs1, 32 * sizeof(float));
908 chctx->bandWidthT[i] = band_tab[i + 1] - band_tab[i];
909 chctx->bandFlagsBuf[i] = 0;
910 chctx->flcoeffs3[i] = chctx->flcoeffs2[i] * 2;
911 chctx->flcoeffs5[i] = 1.0;
915 if (chctx->levlCoeffBuf[i] == 16) {
916 chctx->bandWidthT[i] = 0;
919 chctx->bandWidthT[i] = band_tab[i + 1] - band_tab[i];
922 memset(chctx->bandFlagsBuf, 0, BANDS * sizeof(int));
924 if (chctx->bandWidthT[i])
925 chctx->bandFlagsBuf[i] = get_bits1(&q->gb);
927 imc_calculate_coeffs(q, chctx->flcoeffs1, chctx->flcoeffs2,
928 chctx->bandWidthT, chctx->flcoeffs3,
929 chctx->flcoeffs5);
937 chctx->bitsBandT[0] = 5;
938 chctx->CWlengthT[0] = 5;
939 chctx->CWlengthT[1] = 5;
940 chctx->CWlengthT[2] = 5;
945 bits = (chctx->levlCoeffBuf[i] == 16) ? 0 : 5;
946 chctx->bitsBandT[i] = bits;
948 chctx->CWlengthT[j] = bits;
954 bitscount += !!chctx->bandWidthT[BANDS - 1];
959 if ((ret = bit_allocation(q, chctx, stream_format_code,
963 chctx->decoder_reset = 1;
969 chctx->skipFlags[i] = 0;
971 imc_refine_bit_allocation(q, chctx);
975 chctx->sumLenArr[i] = 0;
978 if (!chctx->skipFlags[j])
979 chctx->sumLenArr[i] += chctx->CWlengthT[j];
982 memset(chctx->codewords, 0, sizeof(chctx->codewords));
984 if (imc_get_coeffs(q, chctx) < 0) {
986 chctx->decoder_reset = 1;
990 if (inverse_quant_coeff(q, chctx, stream_format_code) < 0) {
992 chctx->decoder_reset = 1;
996 memset(chctx->skipFlags, 0, sizeof(chctx->skipFlags));
998 imc_imdct256(q, chctx, avctx->channels);
1062 q->chctx[0].decoder_reset =
1063 q->chctx[1].decoder_reset = 1;