Path: blob/master/libs/jxr/image/decode/strInvTransform.c
4393 views
//*@@@+++@@@@******************************************************************1//2// Copyright © Microsoft Corp.3// All rights reserved.4//5// Redistribution and use in source and binary forms, with or without6// modification, are permitted provided that the following conditions are met:7//8// • Redistributions of source code must retain the above copyright notice,9// this list of conditions and the following disclaimer.10// • Redistributions in binary form must reproduce the above copyright notice,11// this list of conditions and the following disclaimer in the documentation12// and/or other materials provided with the distribution.13//14// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"15// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE16// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE17// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE18// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR19// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF20// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS21// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN22// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)23// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE24// POSSIBILITY OF SUCH DAMAGE.25//26//*@@@---@@@@******************************************************************2728#include "strTransform.h"29#include "strcodec.h"30#include "decode.h"3132/** rotation by -pi/8 **/33#define IROTATE1(a, b) (a) -= (((b) + 1) >> 1), (b) += (((a) + 1) >> 1) // this works well too34#define IROTATE2(a, b) (a) -= (((b)*3 + 4) >> 3), (b) += (((a)*3 + 4) >> 3) // this works well too3536/** local functions **/37static Void invOddOdd(PixelI *, PixelI *, PixelI *, PixelI *);38static Void invOddOddPost(PixelI *, PixelI *, PixelI *, PixelI *);39static Void invOdd(PixelI *, PixelI *, PixelI *, PixelI *);40static Void strHSTdec(PixelI *, PixelI *, PixelI *, PixelI *);41static Void strHSTdec1(PixelI *, PixelI *);42static Void strHSTdec1_alternate(PixelI *, PixelI *);43static Void strHSTdec1_edge(PixelI *pa, PixelI *pd);4445/** IDCT stuff **/46/** reordering should be combined with zigzag scan **/47/** data order before IDCT **/48/** 0 8 4 6 **/49/** 2 10 14 12 **/50/** 1 11 15 13 **/51/** 9 3 7 5 **/52/** data order after IDCT **/53/** 0 1 2 3 **/54/** 4 5 6 7 **/55/** 8 9 10 11 **/56/** 12 13 14 15 **/57Void strIDCT4x4Stage1(PixelI* p)58{59/** top left corner, butterfly => butterfly **/60strDCT2x2up(p + 0, p + 1, p + 2, p + 3);6162/** top right corner, -pi/8 rotation => butterfly **/63invOdd(p + 5, p + 4, p + 7, p + 6);6465/** bottom left corner, butterfly => -pi/8 rotation **/66invOdd(p + 10, p + 8, p + 11, p + 9);6768/** bottom right corner, -pi/8 rotation => -pi/8 rotation **/69invOddOdd(p + 15, p + 14, p + 13, p + 12);7071/** butterfly **/72//FOURBUTTERFLY(p, 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15);73FOURBUTTERFLY_HARDCODED1(p);74}7576Void strIDCT4x4Stage2(PixelI* p)77{78/** bottom left corner, butterfly => -pi/8 rotation **/79invOdd(p + 32, p + 48, p + 96, p + 112);8081/** top right corner, -pi/8 rotation => butterfly **/82invOdd(p + 128, p + 192, p + 144, p + 208);8384/** bottom right corner, -pi/8 rotation => -pi/8 rotation **/85invOddOdd(p + 160, p + 224, p + 176, p + 240);8687/** top left corner, butterfly => butterfly **/88strDCT2x2up(p + 0, p + 64, p + 16, p + 80);8990/** butterfly **/91FOURBUTTERFLY(p, 0, 192, 48, 240, 64, 128, 112, 176, 16, 208, 32, 224, 80, 144, 96, 160);92}9394Void strNormalizeDec(PixelI* p, Bool bChroma)95{96int i;97if (!bChroma) {98//for (i = 0; i < 256; i += 16) {99// p[i] <<= 2;100//}101}102else {103for (i = 0; i < 256; i += 16) {104p[i] += p[i];105}106}107}108109/** 2x2 DCT with post-scaling - for use on decoder side **/110Void strDCT2x2dnDec(PixelI *pa, PixelI *pb, PixelI *pc, PixelI *pd)111{112PixelI a, b, c, d, C, t;113a = *pa;114b = *pb;115C = *pc;116d = *pd;117118a += d;119b -= C;120t = ((a - b) >> 1);121c = t - d;122d = t - C;123a -= d;124b += c;125126*pa = a * 2;127*pb = b * 2;128*pc = c * 2;129*pd = d * 2;130}131132133/** post filter stuff **/134/** 2-point post for boundaries **/135Void strPost2(PixelI * a, PixelI * b)136{137*b += ((*a + 4) >> 3);138*a += ((*b + 2) >> 2);139*b += ((*a + 4) >> 3);140}141142Void strPost2_alternate(PixelI * pa, PixelI * pb)143{144PixelI a, b;145a = *pa;146b = *pb;147148/** rotate **/149b += ((a + 2) >> 2);150a += ((b + 1) >> 1);151a += (b >> 5);152a += (b >> 9);153a += (b >> 13);154155b += ((a + 2) >> 2);156157*pa = a;158*pb = b;159}160161Void strPost2x2(PixelI *pa, PixelI *pb, PixelI *pc, PixelI *pd)162{163PixelI a, b, c, d;164a = *pa;165b = *pb;166c = *pc;167d = *pd;168169/** butterflies **/170a += d;171b += c;172d -= (a + 1) >> 1;173c -= (b + 1) >> 1;174175/** rotate **/176b += ((a + 2) >> 2);177a += ((b + 1) >> 1);178b += ((a + 2) >> 2);179180/** butterflies **/181d += (a + 1) >> 1;182c += (b + 1) >> 1;183a -= d;184b -= c;185186*pa = a;187*pb = b;188*pc = c;189*pd = d;190}191192Void strPost2x2_alternate(PixelI *pa, PixelI *pb, PixelI *pc, PixelI *pd)193{194PixelI a, b, c, d;195a = *pa;196b = *pb;197c = *pc;198d = *pd;199200/** butterflies **/201a += d;202b += c;203d -= (a + 1) >> 1;204c -= (b + 1) >> 1;205206/** rotate **/207b += ((a + 2) >> 2);208a += ((b + 1) >> 1);209a += (b >> 5);210a += (b >> 9);211a += (b >> 13);212b += ((a + 2) >> 2);213214/** butterflies **/215d += (a + 1) >> 1;216c += (b + 1) >> 1;217a -= d;218b -= c;219220*pa = a;221*pb = b;222*pc = c;223*pd = d;224}225226/** 4-point post for boundaries **/227Void strPost4(PixelI *pa, PixelI *pb, PixelI *pc, PixelI *pd)228{229PixelI a, b, c, d;230a = *pa;231b = *pb;232c = *pc;233d = *pd;234235a += d, b += c;236d -= ((a + 1) >> 1), c -= ((b + 1) >> 1);237238IROTATE1(c, d);239240d += ((a + 1) >> 1), c += ((b + 1) >> 1);241a -= d - ((d * 3 + 16) >> 5), b -= c - ((c * 3 + 16) >> 5);242d += ((a * 3 + 8) >> 4), c += ((b * 3 + 8) >> 4);243a += ((d * 3 + 16) >> 5), b += ((c * 3 + 16) >> 5);244245*pa = a;246*pb = b;247*pc = c;248*pd = d;249}250251Void strPost4_alternate(PixelI *pa, PixelI *pb, PixelI *pc, PixelI *pd)252{253PixelI a, b, c, d;254a = *pa;255b = *pb;256c = *pc;257d = *pd;258259a += d, b += c;260d -= ((a + 1) >> 1), c -= ((b + 1) >> 1);261262strHSTdec1_edge(&a, &d); strHSTdec1_edge(&b, &c);263IROTATE1(c, d);264d += ((a + 1) >> 1), c += ((b + 1) >> 1);265266a -= d, b -= c;267268*pa = a;269*pb = b;270*pc = c;271*pd = d;272}273274/*****************************************************************************************275Input data offsets:276(15)(14)|(10+64)(11+64) p0 (15)(14)|(74)(75)277(13)(12)|( 8+64)( 9+64) (13)(12)|(72)(73)278--------+-------------- --------+--------279( 5)( 4)|( 0+64) (1+64) p1 ( 5)( 4)|(64)(65)280( 7)( 6)|( 2+64) (3+64) ( 7)( 6)|(66)(67)281*****************************************************************************************/282Void DCCompensate (PixelI *a, PixelI *b, PixelI *c, PixelI *d, int iDC)283{284iDC = iDC>>1;285*a -= iDC;286*d -= iDC;287*b += iDC;288*c += iDC;289}290291#ifndef max292#define max(a,b) (((a) > (b)) ? (a) : (b))293#endif294295#ifndef min296#define min(a,b) (((a) < (b)) ? (a) : (b))297#endif298299int ClipDCL(int iDCL, int iAltDCL)300{301int iClipDCL = 0;302if (iDCL > 0) {303if (iAltDCL > 0)304iClipDCL = min(iDCL, iAltDCL);305else306iClipDCL = 0;307}308else if (iDCL < 0) {309if (iAltDCL < 0)310iClipDCL = max(iDCL, iAltDCL);311else312iClipDCL = 0;313}314return iClipDCL;315}316317Void strPost4x4Stage1Split(PixelI *p0, PixelI *p1, Int iOffset, Int iHPQP, Bool bHPAbsent)318{319int iDCLAlt1, iDCLAlt2, iDCLAlt3, iDCLAlt0;320int iDCL1, iDCL2, iDCL3, iDCL0;321int iTmp1, iTmp2, iTmp3, iTmp0;322323PixelI *p2 = p0 + 72 - iOffset;324PixelI *p3 = p1 + 64 - iOffset;325p0 += 12;326p1 += 4;327328/** buttefly **/329strDCT2x2dn(p0 + 0, p2 + 0, p1 + 0, p3 + 0);330strDCT2x2dn(p0 + 1, p2 + 1, p1 + 1, p3 + 1);331strDCT2x2dn(p0 + 2, p2 + 2, p1 + 2, p3 + 2);332strDCT2x2dn(p0 + 3, p2 + 3, p1 + 3, p3 + 3);333334/** bottom right corner: -pi/8 rotation => -pi/8 rotation **/335invOddOddPost(p3 + 0, p3 + 1, p3 + 2, p3 + 3);336337/** anti diagonal corners: rotation by -pi/8 **/338IROTATE1(p1[2], p1[3]);339IROTATE1(p1[0], p1[1]);340IROTATE1(p2[1], p2[3]);341IROTATE1(p2[0], p2[2]);342343/** butterfly **/344strHSTdec1(p0 + 0, p3 + 0);345strHSTdec1(p0 + 1, p3 + 1);346strHSTdec1(p0 + 2, p3 + 2);347strHSTdec1(p0 + 3, p3 + 3);348strHSTdec(p0 + 0, p2 + 0, p1 + 0, p3 + 0);349strHSTdec(p0 + 1, p2 + 1, p1 + 1, p3 + 1);350strHSTdec(p0 + 2, p2 + 2, p1 + 2, p3 + 2);351strHSTdec(p0 + 3, p2 + 3, p1 + 3, p3 + 3);352353iTmp0 = (*(p0 +0) + *(p1 +0) + *(p2 +0) + *(p3 +0))>>1;354iTmp1 = (*(p0 +1) + *(p1 +1) + *(p2 +1) + *(p3 +1))>>1;355iTmp2 = (*(p0 +2) + *(p1 +2) + *(p2 +2) + *(p3 +2))>>1;356iTmp3 = (*(p0 +3) + *(p1 +3) + *(p2 +3) + *(p3 +3))>>1;357iDCL0 = (iTmp0 * 595 + 65536)>>17; //Approximating 27/5947358iDCL1 = (iTmp1 * 595 + 65536)>>17;359iDCL2 = (iTmp2 * 595 + 65536)>>17;360iDCL3 = (iTmp3 * 595 + 65536)>>17;361if ((abs(iDCL0) < iHPQP && iHPQP > 20) || bHPAbsent) {362iDCLAlt0 = (*(p0 +0) - *(p1 +0) - *(p2 +0) + *(p3 +0))>>1;363iDCL0 = ClipDCL (iDCL0, iDCLAlt0);364DCCompensate (p0 + 0, p2 + 0, p1 + 0, p3 + 0, iDCL0);365}366if ((abs(iDCL1) < iHPQP && iHPQP > 20) || bHPAbsent) {367iDCLAlt1 = (*(p0 +1) - *(p1 +1) - *(p2 +1) + *(p3 +1))>>1;368iDCL1 = ClipDCL (iDCL1, iDCLAlt1);369DCCompensate (p0 + 1, p2 + 1, p1 + 1, p3 + 1, iDCL1);370}371if ((abs(iDCL2) < iHPQP && iHPQP > 20) || bHPAbsent) {372iDCLAlt2 = (*(p0 +2) - *(p1 +2) - *(p2 +2) + *(p3 +2))>>1;373iDCL2 = ClipDCL (iDCL2, iDCLAlt2);374DCCompensate (p0 + 2, p2 + 2, p1 + 2, p3 + 2, iDCL2);375}376if ((abs(iDCL3) < iHPQP && iHPQP > 20) || bHPAbsent) {377iDCLAlt3 = (*(p0 +3) - *(p1 +3) - *(p2 +3) + *(p3 +3))>>1;378iDCL3 = ClipDCL (iDCL3, iDCLAlt3);379DCCompensate (p0 + 3, p2 + 3, p1 + 3, p3 + 3, iDCL3);380}381}382383Void strPost4x4Stage1(PixelI* p, Int iOffset, Int iHPQP, Bool bHPAbsent)384{385strPost4x4Stage1Split(p, p + 16, iOffset, iHPQP, bHPAbsent);386}387388Void strPost4x4Stage1Split_alternate(PixelI *p0, PixelI *p1, Int iOffset)389{390PixelI *p2 = p0 + 72 - iOffset;391PixelI *p3 = p1 + 64 - iOffset;392p0 += 12;393p1 += 4;394395/** buttefly **/396strDCT2x2dn(p0 + 0, p2 + 0, p1 + 0, p3 + 0);397strDCT2x2dn(p0 + 1, p2 + 1, p1 + 1, p3 + 1);398strDCT2x2dn(p0 + 2, p2 + 2, p1 + 2, p3 + 2);399strDCT2x2dn(p0 + 3, p2 + 3, p1 + 3, p3 + 3);400401/** bottom right corner: -pi/8 rotation => -pi/8 rotation **/402invOddOddPost(p3 + 0, p3 + 1, p3 + 2, p3 + 3);403404/** anti diagonal corners: rotation by -pi/8 **/405IROTATE1(p1[2], p1[3]);406IROTATE1(p1[0], p1[1]);407IROTATE1(p2[1], p2[3]);408IROTATE1(p2[0], p2[2]);409410/** butterfly **/411strHSTdec1_alternate(p0 + 0, p3 + 0);412strHSTdec1_alternate(p0 + 1, p3 + 1);413strHSTdec1_alternate(p0 + 2, p3 + 2);414strHSTdec1_alternate(p0 + 3, p3 + 3);415strHSTdec(p0 + 0, p2 + 0, p1 + 0, p3 + 0);416strHSTdec(p0 + 1, p2 + 1, p1 + 1, p3 + 1);417strHSTdec(p0 + 2, p2 + 2, p1 + 2, p3 + 2);418strHSTdec(p0 + 3, p2 + 3, p1 + 3, p3 + 3);419}420421Void strPost4x4Stage1_alternate(PixelI* p, Int iOffset)422{423strPost4x4Stage1Split_alternate(p, p + 16, iOffset);424}425426/*****************************************************************************************427Input data offsets:428(15)(14)|(10+32)(11+32) p0 (15)(14)|(42)(43)429(13)(12)|( 8+32)( 9+32) (13)(12)|(40)(41)430--------+-------------- --------+--------431( 5)( 4)|( 0+32) (1+32) p1 ( 5)( 4)|(32)(33)432( 7)( 6)|( 2+32) (3+32) ( 7)( 6)|(34)(35)433*****************************************************************************************/434435/*****************************************************************************************436Input data offsets:437( -96)(-32)|(32)( 96) p0438( -80)(-16)|(48)(112)439-----------+------------440(-128)(-64)|( 0)( 64) p1441(-112)(-48)|(16)( 80)442*****************************************************************************************/443Void strPost4x4Stage2Split(PixelI* p0, PixelI* p1)444{445/** buttefly **/446strDCT2x2dn(p0 - 96, p0 + 96, p1 - 112, p1 + 80);447strDCT2x2dn(p0 - 32, p0 + 32, p1 - 48, p1 + 16);448strDCT2x2dn(p0 - 80, p0 + 112, p1 - 128, p1 + 64);449strDCT2x2dn(p0 - 16, p0 + 48, p1 - 64, p1 + 0);450451/** bottom right corner: -pi/8 rotation => -pi/8 rotation **/452invOddOddPost(p1 + 0, p1 + 64, p1 + 16, p1 + 80);453454/** anti diagonal corners: rotation by -pi/8 **/455IROTATE1(p0[ 48], p0[ 32]);456IROTATE1(p0[112], p0[ 96]);457IROTATE1(p1[-64], p1[-128]);458IROTATE1(p1[-48], p1[-112]);459460/** butterfly **/461strHSTdec1(p0 - 96, p1 + 80);462strHSTdec1(p0 - 32, p1 + 16);463strHSTdec1(p0 - 80, p1 + 64);464strHSTdec1(p0 - 16, p1 + 0);465466strHSTdec(p0 - 96, p1 - 112, p0 + 96, p1 + 80);467strHSTdec(p0 - 32, p1 - 48, p0 + 32, p1 + 16);468strHSTdec(p0 - 80, p1 - 128, p0 + 112, p1 + 64);469strHSTdec(p0 - 16, p1 - 64, p0 + 48, p1 + 0);470}471472Void strPost4x4Stage2Split_alternate(PixelI* p0, PixelI* p1)473{474/** buttefly **/475strDCT2x2dn(p0 - 96, p0 + 96, p1 - 112, p1 + 80);476strDCT2x2dn(p0 - 32, p0 + 32, p1 - 48, p1 + 16);477strDCT2x2dn(p0 - 80, p0 + 112, p1 - 128, p1 + 64);478strDCT2x2dn(p0 - 16, p0 + 48, p1 - 64, p1 + 0);479480/** bottom right corner: -pi/8 rotation => -pi/8 rotation **/481invOddOddPost(p1 + 0, p1 + 64, p1 + 16, p1 + 80);482483/** anti diagonal corners: rotation by -pi/8 **/484IROTATE1(p0[ 48], p0[ 32]);485IROTATE1(p0[112], p0[ 96]);486IROTATE1(p1[-64], p1[-128]);487IROTATE1(p1[-48], p1[-112]);488489/** butterfly **/490strHSTdec1_alternate(p0 - 96, p1 + 80);491strHSTdec1_alternate(p0 - 32, p1 + 16);492strHSTdec1_alternate(p0 - 80, p1 + 64);493strHSTdec1_alternate(p0 - 16, p1 + 0);494495strHSTdec(p0 - 96, p1 - 112, p0 + 96, p1 + 80);496strHSTdec(p0 - 32, p1 - 48, p0 + 32, p1 + 16);497strHSTdec(p0 - 80, p1 - 128, p0 + 112, p1 + 64);498strHSTdec(p0 - 16, p1 - 64, p0 + 48, p1 + 0);499}500501/**502Hadamard+Scale transform503for some strange reason, breaking up the function into two blocks, strHSTdec1 and strHSTdec504seems to work faster505**/506static Void strHSTdec1(PixelI *pa, PixelI *pd)507{508/** different realization : does rescaling as well! **/509PixelI a, d;510a = *pa;511d = *pd;512513a += d;514d = (a >> 1) - d;515a += (d * 3 + 0) >> 3;516d += (a * 3 + 0) >> 4;517//a += (d * 3 + 4) >> 3;518519*pa = a;520*pd = d;521}522523static Void strHSTdec1_alternate(PixelI *pa, PixelI *pd)524{525/** different realization : does rescaling as well! **/526PixelI a, d;527a = *pa;528d = *pd;529530a += d;531d = (a >> 1) - d;532a += (d * 3 + 0) >> 3;533d += (a * 3 + 0) >> 4;534//a += (d * 3 + 4) >> 3;535536d += (a >> 7);537d -= (a >> 10);538539*pa = a;540*pd = d;541}542543static Void strHSTdec1_edge (PixelI *pa, PixelI *pd)544{545/** different realization as compared to scaling operator for 2D case **/546PixelI a, d;547a = *pa;548d = *pd;549550a += d;551d = (a >> 1) - d;552a += (d * 3 + 0) >> 3;553d += (a * 3 + 0) >> 4;554555//Scaling modification of adding 7/1024 in 2 steps (without multiplication by 7).556d += (a >> 7);557d -= (a >> 10);558559a += (d * 3 + 4) >> 3;560d -= (a >> 1);561a += d;562// End new operations563564*pa = a;565*pd = -d; // Negative sign needed here for 1D scaling case to ensure correct scaling.566}567568static Void strHSTdec(PixelI *pa, PixelI *pb, PixelI *pc, PixelI *pd)569{570/** different realization : does rescaling as well! **/571PixelI a, b, c, d;572a = *pa;573b = *pb;574c = *pc;575d = *pd;576577b -= c;578a += (d * 3 + 4) >> 3;579580d -= (b >> 1);581c = ((a - b) >> 1) - c;582*pc = d;583*pd = c;584*pa = a - c, *pb = b + d;585}586587/** Kron(Rotate(pi/8), Rotate(pi/8)) **/588static Void invOddOdd(PixelI *pa, PixelI *pb, PixelI *pc, PixelI *pd)589{590PixelI a, b, c, d, t1, t2;591a = *pa;592b = *pb;593c = *pc;594d = *pd;595596/** butterflies **/597d += a;598c -= b;599a -= (t1 = d >> 1);600b += (t2 = c >> 1);601602/** rotate pi/4 **/603a -= (b * 3 + 3) >> 3;604b += (a * 3 + 3) >> 2;605a -= (b * 3 + 4) >> 3;606607/** butterflies **/608b -= t2;609a += t1;610c += b;611d -= a;612613/** sign flips **/614*pa = a;615*pb = -b;616*pc = -c;617*pd = d;618}619620/** Kron(Rotate(pi/8), Rotate(pi/8)) **/621static Void invOddOddPost(PixelI *pa, PixelI *pb, PixelI *pc, PixelI *pd)622{623PixelI a, b, c, d, t1, t2;624a = *pa;625b = *pb;626c = *pc;627d = *pd;628629/** butterflies **/630d += a;631c -= b;632a -= (t1 = d >> 1);633b += (t2 = c >> 1);634635/** rotate pi/4 **/636a -= (b * 3 + 6) >> 3;637b += (a * 3 + 2) >> 2;638a -= (b * 3 + 4) >> 3;639640/** butterflies **/641b -= t2;642a += t1;643c += b;644d -= a;645646*pa = a;647*pb = b;648*pc = c;649*pd = d;650}651652653/** Kron(Rotate(-pi/8), [1 1; 1 -1]/sqrt(2)) **/654/** [D C A B] => [a b c d] **/655Void invOdd(PixelI *pa, PixelI *pb, PixelI *pc, PixelI *pd)656{657PixelI a, b, c, d;658a = *pa;659b = *pb;660c = *pc;661d = *pd;662663/** butterflies **/664b += d;665a -= c;666d -= (b) >> 1;667c += (a + 1) >> 1;668669/** rotate pi/8 **/670IROTATE2(a, b);671IROTATE2(c, d);672673/** butterflies **/674c -= (b + 1) >> 1;675d = ((a + 1) >> 1) - d;676b += c;677a -= d;678679*pa = a;680*pb = b;681*pc = c;682*pd = d;683}684685/*************************************************************************686Top-level function to inverse tranform possible part of a macroblock687*************************************************************************/688Int invTransformMacroblock(CWMImageStrCodec * pSC)689{690const OVERLAP olOverlap = pSC->WMISCP.olOverlap;691const COLORFORMAT cfColorFormat = pSC->m_param.cfColorFormat;692// const BITDEPTH_BITS bdBitDepth = pSC->WMII.bdBitDepth;693const Bool left = (pSC->cColumn == 0), right = (pSC->cColumn == pSC->cmbWidth);694const Bool top = (pSC->cRow == 0), bottom = (pSC->cRow == pSC->cmbHeight);695const Bool topORbottom = (top || bottom), leftORright = (left || right);696const Bool topORleft = (top || left), bottomORright = (bottom || right);697const size_t mbWidth = pSC->cmbWidth, mbX = pSC->cColumn;698PixelI * p = NULL;// * pt = NULL;699size_t i;700const size_t iChannels = (cfColorFormat == YUV_420 || cfColorFormat == YUV_422) ? 1 : pSC->m_param.cNumChannels;701const size_t tScale = pSC->m_Dparam->cThumbnailScale;702Int j = 0;703704Int qp[MAX_CHANNELS], dcqp[MAX_CHANNELS], iStrength = (1 << pSC->WMII.cPostProcStrength);705// ERR_CODE result = ICERR_OK;706707Bool bHPAbsent = (pSC->WMISCP.sbSubband == SB_NO_HIGHPASS || pSC->WMISCP.sbSubband == SB_DC_ONLY);708709if(pSC->WMII.cPostProcStrength > 0){710// threshold for post processing711for(i = 0; i < iChannels; i ++){712qp[i] = pSC->pTile[pSC->cTileColumn].pQuantizerLP[i][pSC->MBInfo.iQIndexLP].iQP * iStrength * (olOverlap == OL_NONE ? 2 : 1);713dcqp[i] = pSC->pTile[pSC->cTileColumn].pQuantizerDC[i][0].iQP * iStrength;714}715716if(left) // a new MB row717slideOneMBRow(pSC->pPostProcInfo, pSC->m_param.cNumChannels, mbWidth, top, bottom); // previous current row becomes previous row718}719720//================================================================721// 400_Y, 444_YUV722for (i = 0; i < iChannels && tScale < 16; ++i)723{724PixelI* const p0 = pSC->p0MBbuffer[i];725PixelI* const p1 = pSC->p1MBbuffer[i];726727Int iHPQP = 255;728if (!bHPAbsent)729iHPQP = pSC->pTile[pSC->cTileColumn].pQuantizerHP[i][pSC->MBInfo.iQIndexHP].iQP;730731//================================732// second level inverse transform733if (!bottomORright)734{735if(pSC->WMII.cPostProcStrength > 0)736updatePostProcInfo(pSC->pPostProcInfo, p1, mbX, i); // update postproc info before IDCT737738strIDCT4x4Stage2(p1);739if (pSC->m_param.bScaledArith) {740strNormalizeDec(p1, (i != 0));741}742}743744//================================745// second level inverse overlap746if (OL_TWO == olOverlap)747{748if (leftORright && (!topORbottom))749{750j = left ? 0 : -128;751strPost4(p0 + j + 32, p0 + j + 48, p1 + j + 0, p1 + j + 16);752strPost4(p0 + j + 96, p0 + j + 112, p1 + j + 64, p1 + j + 80);753}754755if (!leftORright)756{757if (topORbottom)758{759p = top ? p1 : p0 + 32;760strPost4(p - 128, p - 64, p + 0, p + 64);761strPost4(p - 112, p - 48, p + 16, p + 80);762p = NULL;763}764else765{766strPost4x4Stage2Split(p0, p1);767}768}769}770771if(pSC->WMII.cPostProcStrength > 0)772postProcMB(pSC->pPostProcInfo, p0, p1, mbX, i, dcqp[i]); // second stage deblocking773774//================================775// first level inverse transform776if(tScale >= 4) // bypass first level transform for 4:1 and smaller thumbnail777continue;778779if (!top)780{781for (j = (left ? 32 : -96); j < (right ? 32 : 160); j += 64)782{783strIDCT4x4Stage1(p0 + j + 0);784strIDCT4x4Stage1(p0 + j + 16);785}786}787788if (!bottom)789{790for (j = (left ? 0 : -128); j < (right ? 0 : 128); j += 64)791{792strIDCT4x4Stage1(p1 + j + 0);793strIDCT4x4Stage1(p1 + j + 16);794}795}796797//================================798// first level inverse overlap799if (OL_NONE != olOverlap)800{801if (leftORright)802{803j = left ? 0 + 10 : -64 + 14;804if (!top)805{806p = p0 + 16 + j;807strPost4(p + 0, p - 2, p + 6, p + 8);808strPost4(p + 1, p - 1, p + 7, p + 9);809strPost4(p + 16, p + 14, p + 22, p + 24);810strPost4(p + 17, p + 15, p + 23, p + 25);811p = NULL;812}813if (!bottom)814{815p = p1 + j;816strPost4(p + 0, p - 2, p + 6, p + 8);817strPost4(p + 1, p - 1, p + 7, p + 9);818p = NULL;819}820if (!topORbottom)821{822strPost4(p0 + 48 + j + 0, p0 + 48 + j - 2, p1 - 10 + j, p1 - 8 + j);823strPost4(p0 + 48 + j + 1, p0 + 48 + j - 1, p1 - 9 + j, p1 - 7 + j);824}825}826827if (top)828{829for (j = (left ? 0 : -192); j < (right ? -64 : 64); j += 64)830{831p = p1 + j;832strPost4(p + 5, p + 4, p + 64, p + 65);833strPost4(p + 7, p + 6, p + 66, p + 67);834p = NULL;835836strPost4x4Stage1(p1 + j, 0, iHPQP, bHPAbsent);837}838}839else if (bottom)840{841for (j = (left ? 0 : -192); j < (right ? -64 : 64); j += 64)842{843strPost4x4Stage1(p0 + 16 + j, 0, iHPQP, bHPAbsent);844strPost4x4Stage1(p0 + 32 + j, 0, iHPQP, bHPAbsent);845846p = p0 + 48 + j;847strPost4(p + 15, p + 14, p + 74, p + 75);848strPost4(p + 13, p + 12, p + 72, p + 73);849p = NULL;850}851}852else853{854for (j = (left ? 0 : -192); j < (right ? -64 : 64); j += 64)855{856strPost4x4Stage1(p0 + 16 + j, 0, iHPQP, bHPAbsent);857strPost4x4Stage1(p0 + 32 + j, 0, iHPQP, bHPAbsent);858strPost4x4Stage1Split(p0 + 48 + j, p1 + j, 0, iHPQP, bHPAbsent);859strPost4x4Stage1(p1 + j, 0, iHPQP, bHPAbsent);860}861}862}863864if(pSC->WMII.cPostProcStrength > 0 && (!topORleft))865postProcBlock(pSC->pPostProcInfo, p0, p1, mbX, i, qp[i]); // destairing and first stage deblocking866}867868//================================================================869// 420_UV870for (i = 0; i < (YUV_420 == cfColorFormat? 2U : 0U) && tScale < 16; ++i)871{872PixelI* const p0 = pSC->p0MBbuffer[1 + i];//(0 == i ? pSC->pU0 : pSC->pV0);873PixelI* const p1 = pSC->p1MBbuffer[1 + i];//(0 == i ? pSC->pU1 : pSC->pV1);874875Int iHPQP = 255;876if (!bHPAbsent)877iHPQP = pSC->pTile[pSC->cTileColumn].pQuantizerHP[i][pSC->MBInfo.iQIndexHP].iQP;878879//========================================880// second level inverse transform (420_UV)881if (!bottomORright)882{883if (!pSC->m_param.bScaledArith) {884strDCT2x2dn(p1, p1 + 32, p1 + 16, p1 + 48);885}886else {887strDCT2x2dnDec(p1, p1 + 32, p1 + 16, p1 + 48);888}889}890891//========================================892// second level inverse overlap (420_UV)893if (OL_TWO == olOverlap)894{895if (leftORright && !topORbottom)896{897j = (left ? 0 : -32);898strPost2(p0 + j + 16, p1 + j);899}900901if (!leftORright)902{903if (topORbottom)904{905p = (top ? p1 : p0 + 16);906strPost2(p - 32, p);907p = NULL;908}909else{910strPost2x2(p0 - 16, p0 + 16, p1 - 32, p1);911}912}913}914915//========================================916// first level inverse transform (420_UV)917if(tScale >= 4) // bypass first level transform for 4:1 and smaller thumbnail918continue;919920if (!top)921{922for (j = (left ? 16 : -16); j < (right ? 16 : 48); j += 32)923{924strIDCT4x4Stage1(p0 + j);925}926}927928if (!bottom)929{930for (j = (left ? 0 : -32); j < (right ? 0 : 32); j += 32)931{932strIDCT4x4Stage1(p1 + j);933}934}935936//========================================937// first level inverse overlap (420_UV)938if (OL_NONE != olOverlap)939{940if(!left && !top)941{942if (bottom)943{944for (j = -48; j < (right ? -16 : 16); j += 32)945{946p = p0 + j;947strPost4(p + 15, p + 14, p + 42, p + 43);948strPost4(p + 13, p + 12, p + 40, p + 41);949p = NULL;950}951}952else953{954for (j = -48; j < (right ? -16 : 16); j += 32)955{956strPost4x4Stage1Split(p0 + j, p1 - 16 + j, 32, iHPQP, bHPAbsent);957}958}959960if (right)961{962if (!bottom)963{964strPost4(p0 - 2 , p0 - 4 , p1 - 28, p1 - 26);965strPost4(p0 - 1 , p0 - 3 , p1 - 27, p1 - 25);966}967968strPost4(p0 - 18, p0 - 20, p0 - 12, p0 - 10);969strPost4(p0 - 17, p0 - 19, p0 - 11, p0 - 9);970}971else972{973strPost4x4Stage1(p0 - 32, 32, iHPQP, bHPAbsent);974}975976strPost4x4Stage1(p0 - 64, 32, iHPQP, bHPAbsent);977}978else if (top)979{980for (j = (left ? 0: -64); j < (right ? -32: 0); j += 32)981{982p = p1 + j + 4;983strPost4(p + 1, p + 0, p + 28, p + 29);984strPost4(p + 3, p + 2, p + 30, p + 31);985p = NULL;986}987}988else if (left)989{990if (!bottom)991{992strPost4(p0 + 26, p0 + 24, p1 + 0, p1 + 2);993strPost4(p0 + 27, p0 + 25, p1 + 1, p1 + 3);994}995996strPost4(p0 + 10, p0 + 8, p0 + 16, p0 + 18);997strPost4(p0 + 11, p0 + 9, p0 + 17, p0 + 19);998}999}1000}10011002//================================================================1003// 422_UV1004for (i = 0; i < (YUV_422 == cfColorFormat? 2U : 0U) && tScale < 16; ++i)1005{1006PixelI* const p0 = pSC->p0MBbuffer[1 + i];//(0 == i ? pSC->pU0 : pSC->pV0);1007PixelI* const p1 = pSC->p1MBbuffer[1 + i];//(0 == i ? pSC->pU1 : pSC->pV1);10081009Int iHPQP = 255;1010if (!bHPAbsent)1011iHPQP = pSC->pTile[pSC->cTileColumn].pQuantizerHP[i][pSC->MBInfo.iQIndexHP].iQP;10121013//========================================1014// second level inverse transform (422_UV)1015if ((!bottomORright) && pSC->m_Dparam->cThumbnailScale < 16)1016{1017// 1D lossless HT1018p1[0] -= ((p1[32] + 1) >> 1);1019p1[32] += p1[0];10201021if (!pSC->m_param.bScaledArith) {1022strDCT2x2dn(p1 + 0, p1 + 64, p1 + 16, p1 + 80);1023strDCT2x2dn(p1 + 32, p1 + 96, p1 + 48, p1 + 112);1024}1025else {1026strDCT2x2dnDec(p1 + 0, p1 + 64, p1 + 16, p1 + 80);1027strDCT2x2dnDec(p1 + 32, p1 + 96, p1 + 48, p1 + 112);1028}1029}10301031//========================================1032// second level inverse overlap (422_UV)1033if (OL_TWO == olOverlap)1034{1035if (!bottom)1036{1037if (leftORright)1038{1039if (!top)1040{1041j = (left ? 0 : -64);1042strPost2(p0 + 48 + j, p1 + j);1043}10441045j = (left ? 16 : -48);1046strPost2(p1 + j, p1 + j + 16);1047}1048else1049{1050if (top)1051{1052strPost2(p1 - 64, p1);1053}1054else1055{1056strPost2x2(p0 - 16, p0 + 48, p1 - 64, p1);1057}10581059strPost2x2(p1 - 48, p1 + 16, p1 - 32, p1 + 32);1060}1061}1062else if (!leftORright)1063{1064strPost2(p0 - 16, p0 + 48);1065}1066}10671068//========================================1069// first level inverse transform (422_UV)1070if(tScale >= 4) // bypass first level transform for 4:1 and smaller thumbnail1071continue;10721073if (!top)1074{1075for (j = (left ? 48 : -16); j < (right ? 48 : 112); j += 64)1076{1077strIDCT4x4Stage1(p0 + j);1078}1079}10801081if (!bottom)1082{1083for (j = (left ? 0 : -64); j < (right ? 0 : 64); j += 64)1084{1085strIDCT4x4Stage1(p1 + j + 0);1086strIDCT4x4Stage1(p1 + j + 16);1087strIDCT4x4Stage1(p1 + j + 32);1088}1089}10901091//========================================1092// first level inverse overlap (422_UV)1093if (OL_NONE != olOverlap)1094{1095if (!top)1096{1097if (leftORright)1098{1099j = (left ? 32 + 10 : -32 + 14);11001101p = p0 + j;1102strPost4(p + 0, p - 2, p + 6, p + 8);1103strPost4(p + 1, p - 1, p + 7, p + 9);11041105p = NULL;1106}11071108for (j = (left ? 0 : -128); j < (right ? -64 : 0); j += 64)1109{1110strPost4x4Stage1(p0 + j + 32, 0, iHPQP, bHPAbsent);1111}1112}11131114if (!bottom)1115{1116if (leftORright)1117{1118j = (left ? 0 + 10 : -64 + 14);11191120p = p1 + j;1121strPost4(p + 0, p - 2, p + 6, p + 8);1122strPost4(p + 1, p - 1, p + 7, p + 9);11231124p += 16;1125strPost4(p + 0, p - 2, p + 6, p + 8);1126strPost4(p + 1, p - 1, p + 7, p + 9);11271128p = NULL;1129}11301131for (j = (left ? 0 : -128); j < (right ? -64 : 0); j += 64)1132{1133strPost4x4Stage1(p1 + j + 0, 0, iHPQP, bHPAbsent);1134strPost4x4Stage1(p1 + j + 16, 0, iHPQP, bHPAbsent);1135}1136}11371138if (topORbottom)1139{1140p = (top ? p1 + 5 : p0 + 48 + 13);1141for (j = (left ? 0 : -128); j < (right ? -64 : 0); j += 64)1142{1143strPost4(p + j + 0, p + j - 1, p + j + 59, p + j + 60);1144strPost4(p + j + 2, p + j + 1, p + j + 61, p + j + 62);1145}1146p = NULL;1147}1148else1149{1150if (leftORright)1151{1152j = (left ? 0 + 0 : -64 + 4);1153strPost4(p0 + j + 48 + 10 + 0, p0 + j + 48 + 10 - 2, p1 + j + 0, p1 + j + 2);1154strPost4(p0 + j + 48 + 10 + 1, p0 + j + 48 + 10 - 1, p1 + j + 1, p1 + j + 3);1155}11561157for (j = (left ? 0 : -128); j < (right ? -64 : 0); j += 64)1158{1159strPost4x4Stage1Split(p0 + j + 48, p1 + j + 0, 0, iHPQP, bHPAbsent);1160}1161}1162}1163}11641165return ICERR_OK;1166}11671168Int invTransformMacroblock_alteredOperators_hard(CWMImageStrCodec * pSC)1169{1170const OVERLAP olOverlap = pSC->WMISCP.olOverlap;1171const COLORFORMAT cfColorFormat = pSC->m_param.cfColorFormat;1172// const BITDEPTH_BITS bdBitDepth = pSC->WMII.bdBitDepth;1173const Bool left = (pSC->cColumn == 0), right = (pSC->cColumn == pSC->cmbWidth);1174const Bool top = (pSC->cRow == 0), bottom = (pSC->cRow == pSC->cmbHeight);1175const Bool topORbottom = (top || bottom), leftORright = (left || right);1176const Bool topORleft = (top || left), bottomORright = (bottom || right);1177Bool leftAdjacentColumn = (pSC->cColumn == 1), rightAdjacentColumn = (pSC->cColumn == pSC->cmbWidth - 1);1178// Bool topAdjacentRow = (pSC->cRow == 1), bottomAdjacentRow = (pSC->cRow == pSC->cmbHeight - 1);1179const size_t mbWidth = pSC->cmbWidth;1180PixelI * p = NULL;// * pt = NULL;1181size_t i;1182const size_t iChannels = (cfColorFormat == YUV_420 || cfColorFormat == YUV_422) ? 1 : pSC->m_param.cNumChannels;1183const size_t tScale = pSC->m_Dparam->cThumbnailScale;1184Int j = 0;11851186Int qp[MAX_CHANNELS], dcqp[MAX_CHANNELS], iStrength = (1 << pSC->WMII.cPostProcStrength);1187// ERR_CODE result = ICERR_OK;11881189#define mbX pSC->mbX1190#define mbY pSC->mbY1191#define tileX pSC->tileX1192#define tileY pSC->tileY1193#define bVertTileBoundary pSC->bVertTileBoundary1194#define bHoriTileBoundary pSC->bHoriTileBoundary1195#define bOneMBLeftVertTB pSC->bOneMBLeftVertTB1196#define bOneMBRightVertTB pSC->bOneMBRightVertTB1197#define iPredBefore pSC->iPredBefore1198#define iPredAfter pSC->iPredAfter11991200if (pSC->WMISCP.bUseHardTileBoundaries) {1201//Add tile location information1202if (pSC->cColumn == 0) {1203bVertTileBoundary = FALSE;1204tileY = 0;1205}1206bOneMBLeftVertTB = bOneMBRightVertTB = FALSE;1207if(tileY > 0 && tileY <= pSC->WMISCP.cNumOfSliceMinus1H && (pSC->cColumn - 1) == pSC->WMISCP.uiTileY[tileY])1208bOneMBRightVertTB = TRUE;1209if(tileY < pSC->WMISCP.cNumOfSliceMinus1H && pSC->cColumn == pSC->WMISCP.uiTileY[tileY + 1]) {1210bVertTileBoundary = TRUE;1211tileY++;1212}1213else1214bVertTileBoundary = FALSE;1215if(tileY < pSC->WMISCP.cNumOfSliceMinus1H && (pSC->cColumn + 1) == pSC->WMISCP.uiTileY[tileY + 1])1216bOneMBLeftVertTB = TRUE;12171218if (pSC->cRow == 0) {1219bHoriTileBoundary = FALSE;1220tileX = 0;1221}1222else if(mbY != pSC->cRow && tileX < pSC->WMISCP.cNumOfSliceMinus1V && pSC->cRow == pSC->WMISCP.uiTileX[tileX + 1]) {1223bHoriTileBoundary = TRUE;1224tileX++;1225}1226else if(mbY != pSC->cRow)1227bHoriTileBoundary = FALSE;1228}1229else {1230bVertTileBoundary = FALSE;1231bHoriTileBoundary = FALSE;1232bOneMBLeftVertTB = FALSE;1233bOneMBRightVertTB = FALSE;1234}1235mbX = pSC->cColumn, mbY = pSC->cRow;12361237if(pSC->WMII.cPostProcStrength > 0){1238// threshold for post processing1239for(i = 0; i < iChannels; i ++){1240qp[i] = pSC->pTile[pSC->cTileColumn].pQuantizerLP[i][pSC->MBInfo.iQIndexLP].iQP * iStrength * (olOverlap == OL_NONE ? 2 : 1);1241dcqp[i] = pSC->pTile[pSC->cTileColumn].pQuantizerDC[i][0].iQP * iStrength;1242}12431244if(left) // a new MB row1245slideOneMBRow(pSC->pPostProcInfo, pSC->m_param.cNumChannels, mbWidth, top, bottom); // previous current row becomes previous row1246}12471248//================================================================1249// 400_Y, 444_YUV1250for (i = 0; i < iChannels && tScale < 16; ++i)1251{1252PixelI* const p0 = pSC->p0MBbuffer[i];1253PixelI* const p1 = pSC->p1MBbuffer[i];12541255//================================1256// second level inverse transform1257if (!bottomORright)1258{1259if(pSC->WMII.cPostProcStrength > 0)1260updatePostProcInfo(pSC->pPostProcInfo, p1, mbX, i); // update postproc info before IDCT12611262strIDCT4x4Stage2(p1);1263if (pSC->m_param.bScaledArith) {1264strNormalizeDec(p1, (i != 0));1265}1266}12671268//================================1269// second level inverse overlap1270if (OL_TWO == olOverlap)1271{1272/* Corner operations */1273if ((top || bHoriTileBoundary) && (left || bVertTileBoundary))1274strPost4_alternate(p1 + 0, p1 + 64, p1 + 0 + 16, p1 + 64 + 16);1275if ((top || bHoriTileBoundary) && (right || bVertTileBoundary))1276strPost4_alternate(p1 - 128, p1 - 64, p1 - 128 + 16, p1 - 64 + 16);1277if ((bottom || bHoriTileBoundary) && (left || bVertTileBoundary))1278strPost4_alternate(p0 + 32, p0 + 96, p0 + 32 + 16, p0 + 96 + 16);1279if ((bottom || bHoriTileBoundary) && (right || bVertTileBoundary))1280strPost4_alternate(p0 - 96, p0 - 32, p0 - 96 + 16, p0 - 32 + 16);1281if ((leftORright || bVertTileBoundary) && (!topORbottom && !bHoriTileBoundary))1282{1283if (left || bVertTileBoundary) {1284j = 0;1285strPost4_alternate(p0 + j + 32, p0 + j + 48, p1 + j + 0, p1 + j + 16);1286strPost4_alternate(p0 + j + 96, p0 + j + 112, p1 + j + 64, p1 + j + 80);1287}1288if (right || bVertTileBoundary) {1289j = -128;1290strPost4_alternate(p0 + j + 32, p0 + j + 48, p1 + j + 0, p1 + j + 16);1291strPost4_alternate(p0 + j + 96, p0 + j + 112, p1 + j + 64, p1 + j + 80);1292}1293}12941295if (!leftORright)1296{1297if ((topORbottom || bHoriTileBoundary) && !bVertTileBoundary)1298{1299if (top || bHoriTileBoundary) {1300p = p1;1301strPost4_alternate(p - 128, p - 64, p + 0, p + 64);1302strPost4_alternate(p - 112, p - 48, p + 16, p + 80);1303p = NULL;1304}1305if (bottom || bHoriTileBoundary) {1306p = p0 + 32;1307strPost4_alternate(p - 128, p - 64, p + 0, p + 64);1308strPost4_alternate(p - 112, p - 48, p + 16, p + 80);1309p = NULL;1310}1311}13121313if (!topORbottom && !bHoriTileBoundary && !bVertTileBoundary)1314strPost4x4Stage2Split_alternate(p0, p1);1315}1316}13171318if(pSC->WMII.cPostProcStrength > 0)1319postProcMB(pSC->pPostProcInfo, p0, p1, mbX, i, dcqp[i]); // second stage deblocking13201321//================================1322// first level inverse transform1323if(tScale >= 4) // bypass first level transform for 4:1 and smaller thumbnail1324continue;13251326if (!top)1327{1328for (j = (left ? 32 : -96); j < (right ? 32 : 160); j += 64)1329{1330strIDCT4x4Stage1(p0 + j + 0);1331strIDCT4x4Stage1(p0 + j + 16);1332}1333}13341335if (!bottom)1336{1337for (j = (left ? 0 : -128); j < (right ? 0 : 128); j += 64)1338{1339// if(tScale == 2 && bdBitDepth != BD_1){1340// MIPgen(p1 + j + 0);1341// MIPgen(p1 + j + 16);1342// }1343strIDCT4x4Stage1(p1 + j + 0);1344strIDCT4x4Stage1(p1 + j + 16);1345}1346}13471348//================================1349// first level inverse overlap1350if (OL_NONE != olOverlap)1351{1352if (leftORright || bVertTileBoundary)1353{1354/* Corner operations */1355if ((top || bHoriTileBoundary) && (left || bVertTileBoundary))1356strPost4_alternate(p1 + 0, p1 + 1, p1 + 2, p1 + 3);1357if ((top || bHoriTileBoundary) && (right || bVertTileBoundary))1358strPost4_alternate(p1 - 59, p1 - 60, p1 - 57, p1 - 58);1359if ((bottom || bHoriTileBoundary) && (left || bVertTileBoundary))1360strPost4_alternate(p0 + 48 + 10, p0 + 48 + 11, p0 + 48 + 8, p0 + 48 + 9);1361if ((bottom || bHoriTileBoundary) && (right || bVertTileBoundary))1362strPost4_alternate(p0 - 1, p0 - 2, p0 - 3, p0 - 4);1363if (left || bVertTileBoundary) {1364j = 0 + 10;1365if (!top)1366{1367p = p0 + 16 + j;1368strPost4_alternate(p + 0, p - 2, p + 6, p + 8);1369strPost4_alternate(p + 1, p - 1, p + 7, p + 9);1370strPost4_alternate(p + 16, p + 14, p + 22, p + 24);1371strPost4_alternate(p + 17, p + 15, p + 23, p + 25);1372p = NULL;1373}1374if (!bottom)1375{1376p = p1 + j;1377strPost4_alternate(p + 0, p - 2, p + 6, p + 8);1378strPost4_alternate(p + 1, p - 1, p + 7, p + 9);1379p = NULL;1380}1381if (!topORbottom && !bHoriTileBoundary)1382{1383strPost4_alternate(p0 + 48 + j + 0, p0 + 48 + j - 2, p1 - 10 + j, p1 - 8 + j);1384strPost4_alternate(p0 + 48 + j + 1, p0 + 48 + j - 1, p1 - 9 + j, p1 - 7 + j);1385}1386}1387if (right || bVertTileBoundary) {1388j = -64 + 14;1389if (!top)1390{1391p = p0 + 16 + j;1392strPost4_alternate(p + 0, p - 2, p + 6, p + 8);1393strPost4_alternate(p + 1, p - 1, p + 7, p + 9);1394strPost4_alternate(p + 16, p + 14, p + 22, p + 24);1395strPost4_alternate(p + 17, p + 15, p + 23, p + 25);1396p = NULL;1397}1398if (!bottom)1399{1400p = p1 + j;1401strPost4_alternate(p + 0, p - 2, p + 6, p + 8);1402strPost4_alternate(p + 1, p - 1, p + 7, p + 9);1403p = NULL;1404}1405if (!topORbottom && !bHoriTileBoundary)1406{1407strPost4_alternate(p0 + 48 + j + 0, p0 + 48 + j - 2, p1 - 10 + j, p1 - 8 + j);1408strPost4_alternate(p0 + 48 + j + 1, p0 + 48 + j - 1, p1 - 9 + j, p1 - 7 + j);1409}1410}1411}14121413if (top || bHoriTileBoundary)1414{1415for (j = (left ? 0 : -192); j < (right ? -64 : 64); j += 64)1416{1417if (!bVertTileBoundary || j != -64) {1418p = p1 + j;1419strPost4_alternate(p + 5, p + 4, p + 64, p + 65);1420strPost4_alternate(p + 7, p + 6, p + 66, p + 67);1421p = NULL;14221423strPost4x4Stage1_alternate(p1 + j, 0);1424}1425}1426}14271428if (bottom || bHoriTileBoundary)1429{1430for (j = (left ? 0 : -192); j < (right ? -64 : 64); j += 64)1431{1432if (!bVertTileBoundary || j != -64) {1433strPost4x4Stage1_alternate(p0 + 16 + j, 0);1434strPost4x4Stage1_alternate(p0 + 32 + j, 0);14351436p = p0 + 48 + j;1437strPost4_alternate(p + 15, p + 14, p + 74, p + 75);1438strPost4_alternate(p + 13, p + 12, p + 72, p + 73);1439p = NULL;1440}1441}1442}14431444if (!top && !bottom && !bHoriTileBoundary)1445{1446for (j = (left ? 0 : -192); j < (right ? -64 : 64); j += 64)1447{1448if (!bVertTileBoundary || j != -64) {1449strPost4x4Stage1_alternate(p0 + 16 + j, 0);1450strPost4x4Stage1_alternate(p0 + 32 + j, 0);1451strPost4x4Stage1Split_alternate(p0 + 48 + j, p1 + j, 0);1452strPost4x4Stage1_alternate(p1 + j, 0);1453}1454}1455}1456}14571458if(pSC->WMII.cPostProcStrength > 0 && (!topORleft))1459postProcBlock(pSC->pPostProcInfo, p0, p1, mbX, i, qp[i]); // destairing and first stage deblocking1460}14611462//================================================================1463// 420_UV1464for (i = 0; i < (YUV_420 == cfColorFormat? 2U : 0U) && tScale < 16; ++i)1465{1466PixelI* const p0 = pSC->p0MBbuffer[1 + i];//(0 == i ? pSC->pU0 : pSC->pV0);1467PixelI* const p1 = pSC->p1MBbuffer[1 + i];//(0 == i ? pSC->pU1 : pSC->pV1);14681469//========================================1470// second level inverse transform (420_UV)1471if (!bottomORright)1472{1473if (!pSC->m_param.bScaledArith) {1474strDCT2x2dn(p1, p1 + 32, p1 + 16, p1 + 48);1475}1476else {1477strDCT2x2dnDec(p1, p1 + 32, p1 + 16, p1 + 48);1478}1479}14801481//========================================1482// second level inverse overlap (420_UV)1483if (OL_TWO == olOverlap)1484{1485if ((leftAdjacentColumn || bOneMBRightVertTB) && (top || bHoriTileBoundary))1486COMPUTE_CORNER_PRED_DIFF(p1 - 64 + 0, *(p1 - 64 + 32));1487if ((rightAdjacentColumn || bOneMBLeftVertTB) && (top || bHoriTileBoundary))1488iPredBefore[i][0] = *(p1 + 0);1489if ((right || bVertTileBoundary) && (top || bHoriTileBoundary))1490COMPUTE_CORNER_PRED_DIFF(p1 - 64 + 32, iPredBefore[i][0]);1491if ((leftAdjacentColumn || bOneMBRightVertTB) && (bottom || bHoriTileBoundary))1492COMPUTE_CORNER_PRED_DIFF(p0 - 64 + 16, *(p0 - 64 + 48));1493if ((rightAdjacentColumn || bOneMBLeftVertTB) && (bottom || bHoriTileBoundary))1494iPredBefore[i][1] = *(p0 + 16);1495if ((right || bVertTileBoundary) && (bottom || bHoriTileBoundary))1496COMPUTE_CORNER_PRED_DIFF(p0 - 64 + 48, iPredBefore[i][1]);14971498if ((leftORright || bVertTileBoundary) && !topORbottom && !bHoriTileBoundary)1499{1500if (left || bVertTileBoundary)1501strPost2_alternate(p0 + 0 + 16, p1 + 0);1502if (right || bVertTileBoundary)1503strPost2_alternate(p0 + -32 + 16, p1 + -32);1504}15051506if (!leftORright)1507{1508if ((topORbottom || bHoriTileBoundary) && !bVertTileBoundary)1509{1510if (top || bHoriTileBoundary)1511strPost2_alternate(p1 - 32, p1);1512if (bottom || bHoriTileBoundary)1513strPost2_alternate(p0 + 16 - 32, p0 + 16);1514}1515else if (!topORbottom && !bHoriTileBoundary && !bVertTileBoundary) {1516strPost2x2_alternate(p0 - 16, p0 + 16, p1 - 32, p1);1517}1518}1519if ((leftAdjacentColumn || bOneMBRightVertTB) && (top || bHoriTileBoundary))1520COMPUTE_CORNER_PRED_ADD(p1 - 64 + 0, *(p1 - 64 + 32));1521if ((rightAdjacentColumn || bOneMBLeftVertTB) && (top || bHoriTileBoundary))1522iPredAfter[i][0] = *(p1 + 0);1523if ((right || bVertTileBoundary) && (top || bHoriTileBoundary))1524COMPUTE_CORNER_PRED_ADD(p1 - 64 + 32, iPredAfter[i][0]);1525if ((leftAdjacentColumn || bOneMBRightVertTB) && (bottom || bHoriTileBoundary))1526COMPUTE_CORNER_PRED_ADD(p0 - 64 + 16, *(p0 - 64 + 48));1527if ((rightAdjacentColumn || bOneMBLeftVertTB) && (bottom || bHoriTileBoundary))1528iPredAfter[i][1] = *(p0 + 16);1529if ((right || bVertTileBoundary) && (bottom || bHoriTileBoundary))1530COMPUTE_CORNER_PRED_ADD(p0 - 64 + 48, iPredAfter[i][1]);1531}15321533//========================================1534// first level inverse transform (420_UV)1535if(tScale >= 4) // bypass first level transform for 4:1 and smaller thumbnail1536continue;15371538if (!top)1539{1540// In order to allow correction operation of corner chroma overlap operators (fixed)1541// processing of left most MB column must be delayed by one MB1542// Thus left MB not processed until leftAdjacentColumn = 11543for (j = ((left) ? 48 : ((leftAdjacentColumn || bOneMBRightVertTB) ? -48 : -16)); j < ((right || bVertTileBoundary) ? 16 : 48); j += 32)1544{1545strIDCT4x4Stage1(p0 + j);1546}1547}15481549if (!bottom)1550{1551// In order to allow correction operation of corner chroma overlap operators (fixed)1552// processing of left most MB column must be delayed by one MB1553// Thus left MB not processed until leftAdjacentColumn = 11554for (j = ((left) ? 32 : ((leftAdjacentColumn || bOneMBRightVertTB) ? -64 : -32)); j < ((right || bVertTileBoundary) ? 0 : 32); j += 32)1555{1556strIDCT4x4Stage1(p1 + j);1557}1558}15591560//========================================1561// first level inverse overlap (420_UV)1562if (OL_NONE != olOverlap)1563{1564/* Corner operations */1565/* Change because the top-left corner ICT will not have happened until leftAdjacentColumn ==1 */1566if ((top || bHoriTileBoundary) && (leftAdjacentColumn || bOneMBRightVertTB))1567strPost4_alternate(p1 - 64 + 0, p1 - 64 + 1, p1 - 64 + 2, p1 - 64 + 3);1568if ((top || bHoriTileBoundary) && (right || bVertTileBoundary))1569strPost4_alternate(p1 - 27, p1 - 28, p1 - 25, p1 - 26);1570/* Change because the bottom-left corner ICT will not have happened until leftAdjacentColumn ==1 */1571if ((bottom || bHoriTileBoundary) && (leftAdjacentColumn || bOneMBRightVertTB))1572strPost4_alternate(p0 - 64 + 16 + 10, p0 - 64 + 16 + 11, p0 - 64 + 16 + 8, p0 - 64 + 16 + 9);1573if ((bottom || bHoriTileBoundary) && (right || bVertTileBoundary))1574strPost4_alternate(p0 - 1, p0 - 2, p0 - 3, p0 - 4);1575if(!left && !top)1576{1577/* Change because the vertical 1-D overlap operations of the left edge pixels cannot be performed until leftAdjacentColumn ==1 */1578if (leftAdjacentColumn || bOneMBRightVertTB)1579{1580if (!bottom && !bHoriTileBoundary)1581{1582strPost4_alternate(p0 - 64 + 26, p0 - 64 + 24, p1 - 64 + 0, p1 - 64 + 2);1583strPost4_alternate(p0 - 64 + 27, p0 - 64 + 25, p1 - 64 + 1, p1 - 64 + 3);1584}15851586strPost4_alternate(p0 - 64 + 10, p0 - 64 + 8, p0 - 64 + 16, p0 - 64 + 18);1587strPost4_alternate(p0 - 64 + 11, p0 - 64 + 9, p0 - 64 + 17, p0 - 64 + 19);1588}1589if (bottom || bHoriTileBoundary)1590{1591p = p0 + -48;1592strPost4_alternate(p + 15, p + 14, p + 42, p + 43);1593strPost4_alternate(p + 13, p + 12, p + 40, p + 41);1594p = NULL;15951596if (!right && !bVertTileBoundary)1597{1598p = p0 + -16;1599strPost4_alternate(p + 15, p + 14, p + 42, p + 43);1600strPost4_alternate(p + 13, p + 12, p + 40, p + 41);1601p = NULL;1602}1603}1604else1605{1606strPost4x4Stage1Split_alternate(p0 + -48, p1 - 16 + -48, 32);16071608if (!right && !bVertTileBoundary)1609strPost4x4Stage1Split_alternate(p0 + -16, p1 - 16 + -16, 32);1610}16111612if (right || bVertTileBoundary)1613{1614if (!bottom && !bHoriTileBoundary)1615{1616strPost4_alternate(p0 - 2 , p0 - 4 , p1 - 28, p1 - 26);1617strPost4_alternate(p0 - 1 , p0 - 3 , p1 - 27, p1 - 25);1618}16191620strPost4_alternate(p0 - 18, p0 - 20, p0 - 12, p0 - 10);1621strPost4_alternate(p0 - 17, p0 - 19, p0 - 11, p0 - 9);1622}1623else1624{1625strPost4x4Stage1_alternate(p0 - 32, 32);1626}16271628strPost4x4Stage1_alternate(p0 - 64, 32);1629}16301631if (top || bHoriTileBoundary)1632{1633if (!left)1634{1635p = p1 + -64 + 4;1636strPost4_alternate(p + 1, p + 0, p + 28, p + 29);1637strPost4_alternate(p + 3, p + 2, p + 30, p + 31);1638p = NULL;1639}16401641if (!left && !right && !bVertTileBoundary)1642{1643p = p1 + -32 + 4;1644strPost4_alternate(p + 1, p + 0, p + 28, p + 29);1645strPost4_alternate(p + 3, p + 2, p + 30, p + 31);1646p = NULL;1647}1648}1649}1650}16511652//================================================================1653// 422_UV1654for (i = 0; i < (YUV_422 == cfColorFormat? 2U : 0U) && tScale < 16; ++i)1655{1656PixelI* const p0 = pSC->p0MBbuffer[1 + i];//(0 == i ? pSC->pU0 : pSC->pV0);1657PixelI* const p1 = pSC->p1MBbuffer[1 + i];//(0 == i ? pSC->pU1 : pSC->pV1);16581659//========================================1660// second level inverse transform (422_UV)1661if ((!bottomORright) && pSC->m_Dparam->cThumbnailScale < 16)1662{1663// 1D lossless HT1664p1[0] -= ((p1[32] + 1) >> 1);1665p1[32] += p1[0];16661667if (!pSC->m_param.bScaledArith) {1668strDCT2x2dn(p1 + 0, p1 + 64, p1 + 16, p1 + 80);1669strDCT2x2dn(p1 + 32, p1 + 96, p1 + 48, p1 + 112);1670}1671else {1672strDCT2x2dnDec(p1 + 0, p1 + 64, p1 + 16, p1 + 80);1673strDCT2x2dnDec(p1 + 32, p1 + 96, p1 + 48, p1 + 112);1674}1675}16761677//========================================1678// second level inverse overlap (422_UV)1679if (OL_TWO == olOverlap)1680{1681if ((leftAdjacentColumn || bOneMBRightVertTB) && (top || bHoriTileBoundary))1682COMPUTE_CORNER_PRED_DIFF(p1 - 128 + 0, *(p1 - 128 + 64));16831684if ((rightAdjacentColumn || bOneMBLeftVertTB) && (top || bHoriTileBoundary))1685iPredBefore[i][0] = *(p1 + 0);1686if ((right || bVertTileBoundary) && (top || bHoriTileBoundary))1687COMPUTE_CORNER_PRED_DIFF(p1 - 128 + 64, iPredBefore[i][0]);16881689if ((leftAdjacentColumn || bOneMBRightVertTB) && (bottom || bHoriTileBoundary))1690COMPUTE_CORNER_PRED_DIFF(p0 - 128 + 48, *(p0 - 128 + 112));16911692if ((rightAdjacentColumn || bOneMBLeftVertTB) && (bottom || bHoriTileBoundary))1693iPredBefore[i][1] = *(p0 + 48);1694if ((right || bVertTileBoundary) && (bottom || bHoriTileBoundary))1695COMPUTE_CORNER_PRED_DIFF(p0 - 128 + 112, iPredBefore[i][1]);16961697if (!bottom)1698{1699if (leftORright || bVertTileBoundary)1700{1701if (!top && !bHoriTileBoundary)1702{1703if (left || bVertTileBoundary)1704strPost2_alternate(p0 + 48 + 0, p1 + 0);17051706if (right || bVertTileBoundary)1707strPost2_alternate(p0 + 48 + -64, p1 + -64);1708}17091710if (left || bVertTileBoundary)1711strPost2_alternate(p1 + 16, p1 + 16 + 16);17121713if (right || bVertTileBoundary)1714strPost2_alternate(p1 + -48, p1 + -48 + 16);1715}17161717if (!leftORright && !bVertTileBoundary)1718{1719if (top || bHoriTileBoundary)1720strPost2_alternate(p1 - 64, p1);1721else1722strPost2x2_alternate(p0 - 16, p0 + 48, p1 - 64, p1);17231724strPost2x2_alternate(p1 - 48, p1 + 16, p1 - 32, p1 + 32);1725}1726}17271728if ((bottom || bHoriTileBoundary) && (!leftORright && !bVertTileBoundary))1729strPost2_alternate(p0 - 16, p0 + 48);17301731if ((leftAdjacentColumn || bOneMBRightVertTB) && (top || bHoriTileBoundary))1732COMPUTE_CORNER_PRED_ADD(p1 - 128 + 0, *(p1 - 128 + 64));17331734if ((rightAdjacentColumn || bOneMBLeftVertTB) && (top || bHoriTileBoundary))1735iPredAfter[i][0] = *(p1 + 0);1736if ((right || bVertTileBoundary) && (top || bHoriTileBoundary))1737COMPUTE_CORNER_PRED_ADD(p1 - 128 + 64, iPredAfter[i][0]);17381739if ((leftAdjacentColumn || bOneMBRightVertTB) && (bottom || bHoriTileBoundary))1740COMPUTE_CORNER_PRED_ADD(p0 - 128 + 48, *(p0 - 128 + 112));17411742if ((rightAdjacentColumn || bOneMBLeftVertTB) && (bottom || bHoriTileBoundary))1743iPredAfter[i][1] = *(p0 + 48);1744if ((right || bVertTileBoundary) && (bottom || bHoriTileBoundary))1745COMPUTE_CORNER_PRED_ADD(p0 - 128 + 112, iPredAfter[i][1]);1746}17471748//========================================1749// first level inverse transform (422_UV)1750if(tScale >= 4) // bypass first level transform for 4:1 and smaller thumbnail1751continue;17521753if (!top)1754{1755// Need to delay processing of left column until leftAdjacentColumn = 1 for corner overlap operators1756// Since 422 has no vertical downsampling, no top MB delay of processing is necessary1757for (j = (left ? 112 : ((leftAdjacentColumn || bOneMBRightVertTB) ? -80 : -16)); j < ((right || bVertTileBoundary) ? 48 : 112); j += 64)1758{1759strIDCT4x4Stage1(p0 + j);1760}1761}17621763if (!bottom)1764{1765// Need to delay processing of left column until leftAdjacentColumn = 1 for corner overlap operators1766// Since 422 has no vertical downsampling, no top MB delay of processing is necessary1767for (j = (left ? 64 : ((leftAdjacentColumn || bOneMBRightVertTB) ? -128 : -64)); j < ((right || bVertTileBoundary) ? 0 : 64); j += 64)1768{1769strIDCT4x4Stage1(p1 + j + 0);1770strIDCT4x4Stage1(p1 + j + 16);1771strIDCT4x4Stage1(p1 + j + 32);1772}1773}17741775//========================================1776// first level inverse overlap (422_UV)1777if (OL_NONE != olOverlap)1778{1779/* Corner operations */1780if ((top || bHoriTileBoundary) && (leftAdjacentColumn || bOneMBRightVertTB))1781strPost4_alternate(p1 - 128 + 0, p1 - 128 + 1, p1 - 128 + 2, p1 - 128 + 3);1782if ((top || bHoriTileBoundary) && (right || bVertTileBoundary))1783strPost4_alternate(p1 - 59, p1 - 60, p1 - 57, p1 - 58);1784if ((bottom || bHoriTileBoundary) && (leftAdjacentColumn || bOneMBRightVertTB))1785strPost4_alternate(p0 - 128 + 48 + 10, p0 - 128 + 48 + 11, p0 - 128 + 48 + 8, p0 - 128 + 48 + 9);1786if ((bottom || bHoriTileBoundary) && (right || bVertTileBoundary))1787strPost4_alternate(p0 - 1, p0 - 2, p0 - 3, p0 - 4);1788if (!top)1789{1790// Need to delay processing of left column until leftAdjacentColumn = 1 for corner overlap operators1791if (leftAdjacentColumn || bOneMBRightVertTB) {1792p = p0 + 32 + 10 - 128;1793strPost4_alternate(p + 0, p - 2, p + 6, p + 8);1794strPost4_alternate(p + 1, p - 1, p + 7, p + 9);1795p = NULL;1796}17971798if (right || bVertTileBoundary) {1799p = p0 + -32 + 14;1800strPost4_alternate(p + 0, p - 2, p + 6, p + 8);1801strPost4_alternate(p + 1, p - 1, p + 7, p + 9);1802p = NULL;1803}18041805for (j = (left ? 0 : -128); j < ((right || bVertTileBoundary) ? -64 : 0); j += 64)1806strPost4x4Stage1_alternate(p0 + j + 32, 0);1807}18081809if (!bottom)1810{1811// Need to delay processing of left column until leftAdjacentColumn = 1 for corner overlap operators1812if (leftAdjacentColumn || bOneMBRightVertTB)1813{1814p = p1 + 0 + 10 - 128;1815strPost4_alternate(p + 0, p - 2, p + 6, p + 8);1816strPost4_alternate(p + 1, p - 1, p + 7, p + 9);1817p += 16;1818strPost4_alternate(p + 0, p - 2, p + 6, p + 8);1819strPost4_alternate(p + 1, p - 1, p + 7, p + 9);1820p = NULL;1821}18221823if (right || bVertTileBoundary)1824{1825p = p1 + -64 + 14;1826strPost4_alternate(p + 0, p - 2, p + 6, p + 8);1827strPost4_alternate(p + 1, p - 1, p + 7, p + 9);1828p += 16;1829strPost4_alternate(p + 0, p - 2, p + 6, p + 8);1830strPost4_alternate(p + 1, p - 1, p + 7, p + 9);1831p = NULL;1832}18331834for (j = (left ? 0 : -128); j < ((right || bVertTileBoundary) ? -64 : 0); j += 64)1835{1836strPost4x4Stage1_alternate(p1 + j + 0, 0);1837strPost4x4Stage1_alternate(p1 + j + 16, 0);1838}1839}18401841if (topORbottom || bHoriTileBoundary)1842{1843if (top || bHoriTileBoundary) {1844p = p1 + 5;1845for (j = (left ? 0 : -128); j < ((right || bVertTileBoundary) ? -64 : 0); j += 64)1846{1847strPost4_alternate(p + j + 0, p + j - 1, p + j + 59, p + j + 60);1848strPost4_alternate(p + j + 2, p + j + 1, p + j + 61, p + j + 62);1849}1850p = NULL;1851}18521853if (bottom || bHoriTileBoundary) {1854p = p0 + 48 + 13;1855for (j = (left ? 0 : -128); j < ((right || bVertTileBoundary) ? -64 : 0); j += 64)1856{1857strPost4_alternate(p + j + 0, p + j - 1, p + j + 59, p + j + 60);1858strPost4_alternate(p + j + 2, p + j + 1, p + j + 61, p + j + 62);1859}1860p = NULL;1861}1862}1863else1864{1865// Need to delay processing of left column until leftAdjacentColumn = 1 for corner overlap operators1866if (leftAdjacentColumn || bOneMBRightVertTB)1867{1868j = 0 + 0 - 128;1869strPost4_alternate(p0 + j + 48 + 10 + 0, p0 + j + 48 + 10 - 2, p1 + j + 0, p1 + j + 2);1870strPost4_alternate(p0 + j + 48 + 10 + 1, p0 + j + 48 + 10 - 1, p1 + j + 1, p1 + j + 3);1871}18721873if (right || bVertTileBoundary)1874{1875j = -64 + 4;1876strPost4_alternate(p0 + j + 48 + 10 + 0, p0 + j + 48 + 10 - 2, p1 + j + 0, p1 + j + 2);1877strPost4_alternate(p0 + j + 48 + 10 + 1, p0 + j + 48 + 10 - 1, p1 + j + 1, p1 + j + 3);1878}18791880for (j = (left ? 0 : -128); j < ((right || bVertTileBoundary) ? -64 : 0); j += 64)1881strPost4x4Stage1Split_alternate(p0 + j + 48, p1 + j + 0, 0);1882}1883}1884}18851886return ICERR_OK;1887}188818891890