FastLED 3.9.15
Loading...
Searching...
No Matches

◆ HybridTransform()

static int32_t fl::third_party::HybridTransform ( int32_t * xCurr,
int32_t * xPrev,
int32_t y[BLOCK_SIZE][NBANDS],
SideInfoSub * sis,
BlockCount * bc )
static

Definition at line 634 of file imdct.hpp.

635{
636 int32_t xPrevWin[18];
637 int32_t currWinIdx, prevWinIdx;
638 int32_t i, j, nBlocksOut, nonZero, mOut;
639 int32_t xp;
640
641 ASSERT(bc->nBlocksLong <= NBANDS);
642 ASSERT(bc->nBlocksTotal <= NBANDS);
643 ASSERT(bc->nBlocksPrev <= NBANDS);
644
645 mOut = 0;
646
647 /* do long blocks, if any */
648 for(i = 0; i < bc->nBlocksLong; i++) {
649 /* currWinIdx picks the right window for long blocks (if mixed, long blocks use window type 0) */
650 currWinIdx = sis->blockType;
651 if (sis->mixedBlock && i < bc->currWinSwitch)
652 currWinIdx = 0;
653
654 prevWinIdx = bc->prevType;
655 if (i < bc->prevWinSwitch)
656 prevWinIdx = 0;
657
658 /* do 36-point IMDCT, including windowing and overlap-add */
659 mOut |= IMDCT36(xCurr, xPrev, &(y[0][i]), currWinIdx, prevWinIdx, i, bc->gbIn);
660 xCurr += 18;
661 xPrev += 9;
662 }
663
664 /* do short blocks (if any) */
665 for ( ; i < bc->nBlocksTotal; i++) {
666 ASSERT(sis->blockType == 2);
667
668 prevWinIdx = bc->prevType;
669 if (i < bc->prevWinSwitch)
670 prevWinIdx = 0;
671
672 mOut |= IMDCT12x3(xCurr, xPrev, &(y[0][i]), prevWinIdx, i, bc->gbIn);
673 xCurr += 18;
674 xPrev += 9;
675 }
676 nBlocksOut = i;
677
678 /* window and overlap prev if prev longer that current */
679 for ( ; i < bc->nBlocksPrev; i++) {
680 prevWinIdx = bc->prevType;
681 if (i < bc->prevWinSwitch)
682 prevWinIdx = 0;
683 WinPrevious(xPrev, xPrevWin, prevWinIdx);
684
685 nonZero = 0;
686 /* sign_bit = -1 for odd i, 0 for even i */
687 int32_t sign_bit = ((i & 1) ? (int32_t)(-1) : 0);
688 for (j = 0; j < 9; j++) {
689 xp = xPrevWin[2*j+0] * 4L; /* * 4 temp for scaling */
690 nonZero |= xp;
691 y[2*j+0][i] = xp;
692 mOut |= FASTABS(xp);
693
694 /* frequency inversion on odd blocks/odd samples (flip sign if i odd, j odd) */
695 xp = xPrevWin[2*j+1] * 4L;
696 xp = (xp ^ sign_bit) + (i & 0x01);
697 nonZero |= xp;
698 y[2*j+1][i] = xp;
699 mOut |= FASTABS(xp);
700
701 xPrev[j] = 0;
702 }
703 xPrev += 9;
704 if (nonZero)
705 nBlocksOut = i;
706 }
707
708 /* clear rest of blocks */
709 for ( ; i < 32; i++) {
710 for (j = 0; j < 18; j++)
711 y[j][i] = 0;
712 }
713
714 bc->gbOut = CLZ(mOut) - 1;
715
716 return nBlocksOut;
717}
int y
Definition simple.h:93
#define NBANDS
Definition coder.h:107
#define ASSERT(x)
Definition coder.h:56
__inline int32_t FASTABS(int32_t x) FL_NOEXCEPT
Absolute value of x.
Definition assembly.h:513
static void WinPrevious(int32_t *xPrev, int32_t *xPrevWin, int32_t btPrev) FL_NOEXCEPT
Definition imdct.hpp:141
static int32_t IMDCT12x3(int32_t *xCurr, int32_t *xPrev, int32_t *y, int32_t btPrev, int32_t blockIdx, int32_t gb) FL_NOEXCEPT
Definition imdct.hpp:551
fl::i32 int32_t
Definition coder.h:220
__inline int32_t CLZ(int32_t x) FL_NOEXCEPT
Leading zeros.
Definition assembly.h:527
static int32_t IMDCT36(int32_t *xCurr, int32_t *xPrev, int32_t *y, int32_t btCurr, int32_t btPrev, int32_t blockIdx, int32_t gb) FL_NOEXCEPT
Definition imdct.hpp:381

References ASSERT, BLOCK_SIZE, CLZ(), FASTABS(), FL_NOEXCEPT, IMDCT12x3(), IMDCT36(), NBANDS, WinPrevious(), and fl::y.

Referenced by IMDCT().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: