📄 stagescodinggaggles.c
字号:
else
{
BlockCodingInfo[BlockSeq].RefineBits.RefineParent.ParentRefSymbol = 0x7;
}
}
}
}
}
void StagesDeCodingGaggles2(StructCodingPara *PtrCoding,
BitPlaneBits *BlockCodingInfo,
UCHAR8 BlocksInGaggles,
UCHAR8 *CodeOptionsAllGaggles,
BOOL *FlagCodeOptionOutput)
{
UCHAR8 temp_x;
UCHAR8 temp_y;
UCHAR8 counter;
UCHAR8 BlockSeq;
short temp = 1;
int i;
int k;
int p;
DWORD32 temp_DWORD;
UCHAR8 BitPlane = PtrCoding->BitPlane;
StrSymbolDetails StrSymbol;
BOOL Flag;
for ( BlockSeq = 0; BlockSeq < BlocksInGaggles; BlockSeq ++)
{
if (BlockCodingInfo[BlockSeq].BitMaxAC < BitPlane)
continue;
Flag = FALSE;
// decoding TranB
counter = 0;
for(i = 0; i < 3; i++)
{
if((PtrCoding->PtrHeader->Header.Part4).DWTType == INTEGER_WAVELET)
{
if(((i == 0) && (PtrCoding->PtrHeader->Header.Part4.CustomWtHL2_2bits >= BitPlane) &&
(PtrCoding->PtrHeader->Header.Part4.CustomWtHL1_2bits >= BitPlane)) // HL3 band.
|| ((i == 1) && (PtrCoding->PtrHeader->Header.Part4.CustomWtLH2_2bits >= BitPlane)&&
(PtrCoding->PtrHeader->Header.Part4.CustomWtLH1_2bits >= BitPlane)) // HL3 band.
|| ((i == 2) && (PtrCoding->PtrHeader->Header.Part4.CustomWtHH2_2bits >= BitPlane)&&
(PtrCoding->PtrHeader->Header.Part4.CustomWtHH1_2bits >= BitPlane))) // HL3 band.
continue;
}
Flag = TRUE;
if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & (1 << (2 - i))) == 0)
counter ++;
}
if ((PtrCoding->DecodingStopLocations.BitPlaneStopDecoding != -1)
&& PtrCoding->RateReached == TRUE && (!PtrCoding->DecodingStopLocations.LocationFind))
{
PtrCoding->DecodingStopLocations.BlockNoStopDecoding = BlockSeq;
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 0;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 2;
PtrCoding->DecodingStopLocations.LocationFind = TRUE;
return;
}
if(Flag == FALSE)
continue;
if (BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranB != 1)
{
DWORD32 Temp_Word;
BitsRead(PtrCoding, &Temp_Word, 1);
BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranB = (UCHAR8)Temp_Word;
if ((PtrCoding->DecodingStopLocations.BitPlaneStopDecoding != -1)
&& PtrCoding->RateReached == TRUE && !PtrCoding->DecodingStopLocations.LocationFind)
{
PtrCoding->DecodingStopLocations.BlockNoStopDecoding = BlockSeq;
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 0;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 2;
PtrCoding->DecodingStopLocations.LocationFind = TRUE;
return;
}
}
if(BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranB == 0)
continue;
// decoding TranD
if(counter != 0)
{
DWORD32 TempWord;
if(counter != 1)
{
if(FlagCodeOptionOutput[counter - 2] == FALSE)
{
FlagCodeOptionOutput[counter - 2] = TRUE;
if(counter == 2)
{
BitsRead(PtrCoding, &TempWord, 1);
}
else
{
BitsRead(PtrCoding, &TempWord, 2);
}
CodeOptionsAllGaggles[counter - 2] = (UCHAR8) TempWord;
if ((PtrCoding->DecodingStopLocations.BitPlaneStopDecoding != -1)
&& PtrCoding->RateReached == TRUE && !PtrCoding->DecodingStopLocations.LocationFind)
{
PtrCoding->DecodingStopLocations.BlockNoStopDecoding = BlockSeq;
if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & 0x4) == 0)
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 0;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 2;
}
else if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & 0x2) == 0)
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 2;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 0;
}
else
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 2;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 2;
}
PtrCoding->DecodingStopLocations.LocationFind = TRUE;
return;
}
}
}
RiceDecoding(&TempWord, counter, CodeOptionsAllGaggles, PtrCoding);
if ((PtrCoding->DecodingStopLocations.BitPlaneStopDecoding != -1)
&& PtrCoding->RateReached == TRUE && !PtrCoding->DecodingStopLocations.LocationFind)
{
PtrCoding->DecodingStopLocations.BlockNoStopDecoding = BlockSeq;
if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & 0x4) == 0)
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 0;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 2;
}
else if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & 0x2) == 0)
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 2;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 0;
}
else
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 2;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 2;
}
PtrCoding->DecodingStopLocations.LocationFind = TRUE;
return;
}
StrSymbol.sym_mapped_pattern = (UCHAR8) TempWord;
StrSymbol.sym_len = counter;
StrSymbol.type = ENUM_TRAN_D;
DeMappingPattern(&StrSymbol);
// assign StrSymbol.sym_val to TranD.
for( i = 0; i < 3; i ++)
{
if((PtrCoding->PtrHeader->Header.Part4).DWTType == INTEGER_WAVELET)
{
if(((i == 0) && (PtrCoding->PtrHeader->Header.Part4.CustomWtHL2_2bits >= BitPlane)&&
(PtrCoding->PtrHeader->Header.Part4.CustomWtHL1_2bits >= BitPlane)) // HL3 band.
|| ((i == 1) && (PtrCoding->PtrHeader->Header.Part4.CustomWtLH2_2bits >= BitPlane)&&
(PtrCoding->PtrHeader->Header.Part4.CustomWtLH1_2bits >= BitPlane)) // HL3 band.
|| ((i == 2) && (PtrCoding->PtrHeader->Header.Part4.CustomWtHH2_2bits >= BitPlane)&&
(PtrCoding->PtrHeader->Header.Part4.CustomWtHH1_2bits >= BitPlane))) // HL3 band.
continue;
}
if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & ( 1 << (2 - i))) > 0)
continue;
BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD += (((StrSymbol.sym_val >> (counter - 1)) & 0x01) << (2- i));
counter --;
}
}
for(k = 0; k < 3; k ++)
{
BlockCodingInfo[BlockSeq].RefineBits.RefineChildren.ChildrenRefSymbol <<= 4;
if((PtrCoding->PtrHeader->Header.Part4).DWTType == INTEGER_WAVELET)
{
if(((k == 0) && (PtrCoding->PtrHeader->Header.Part4.CustomWtHL2_2bits >= BitPlane)) // HL3 band.
|| ((k == 1) && (PtrCoding->PtrHeader->Header.Part4.CustomWtLH2_2bits >= BitPlane)) // HL3 band.
|| ((k == 2) && (PtrCoding->PtrHeader->Header.Part4.CustomWtHH2_2bits >= BitPlane))) // HL3 band.
continue;
}
if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & ( 1 << (2 - k))) > 0)
{
counter = 0;
for (i = 0; i < 4; i ++)
{
if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TypeCi[k].TypeC & (1 << (3 - i))) == 0)
counter ++;
}
if(counter != 0)
{
DWORD32 TempWord;
short t = 0;
if(counter != 1)
{
if(FlagCodeOptionOutput[counter - 2] == FALSE)
{
FlagCodeOptionOutput[counter - 2] = TRUE;
if(counter == 2)
{
BitsRead(PtrCoding, &TempWord, 1);
}
else
{
BitsRead(PtrCoding, &TempWord, 2);
}
CodeOptionsAllGaggles[counter - 2] = (UCHAR8) TempWord;
if ((PtrCoding->DecodingStopLocations.BitPlaneStopDecoding != -1)
&& PtrCoding->RateReached == TRUE && !PtrCoding->DecodingStopLocations.LocationFind)
{
PtrCoding->DecodingStopLocations.BlockNoStopDecoding = BlockSeq;
if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & 0x4) == 0)
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 0;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 2;
}
else if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & 0x2) == 0)
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 2;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 0;
}
else
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 2;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 2;
}
PtrCoding->DecodingStopLocations.LocationFind = TRUE;
return;
}
}
}
RiceDecoding(&TempWord, counter, CodeOptionsAllGaggles, PtrCoding);
if ((PtrCoding->DecodingStopLocations.BitPlaneStopDecoding != -1)
&& PtrCoding->RateReached == TRUE && !PtrCoding->DecodingStopLocations.LocationFind)
{
PtrCoding->DecodingStopLocations.BlockNoStopDecoding = BlockSeq;
if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & 0x4) == 0)
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 0;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 2;
}
else if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranD & 0x2) == 0)
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 2;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 0;
}
else
{
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = 2;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = 2;
}
PtrCoding->DecodingStopLocations.LocationFind = TRUE;
return;
}
StrSymbol.sym_mapped_pattern = (UCHAR8)TempWord;
StrSymbol.sym_len = counter;
StrSymbol.type = ENUM_TYPE_CI;
DeMappingPattern(&StrSymbol);
temp_x = (k >= 1 ? 1 : 0);
temp_x *= 2;
temp_y = (k != 1 ? 1 : 0);
temp_y *= 2;
for (i = temp_x ; i < temp_x + 2; i ++)
for ( p = temp_y; p < temp_y + 2; p ++)
{
if((BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TypeCi[k].TypeC & (1 << (3 - t))) == 0)
{
temp_DWORD = ((StrSymbol.sym_val >> (counter - 1)) & 0x01);
if(temp_DWORD > 0)
{
DWORD32 TempWord;
BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TypeCi[k].TypeC += (1 << (3 - t));
BlockCodingInfo[BlockSeq].PtrBlockAddress[i][p] += (1 << (BitPlane - 1));
BitsRead(PtrCoding, &TempWord, 1); // sign bit
if (TempWord == NEGATIVE_SIGN)
BlockCodingInfo[BlockSeq].PtrBlockAddress[i][p] = - BlockCodingInfo[BlockSeq].PtrBlockAddress[i][p];
if ((PtrCoding->DecodingStopLocations.BitPlaneStopDecoding != -1)
&& PtrCoding->RateReached == TRUE && (!PtrCoding->DecodingStopLocations.LocationFind))
{
PtrCoding->DecodingStopLocations.BlockNoStopDecoding = BlockSeq;
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = i;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = p;
PtrCoding->DecodingStopLocations.LocationFind = TRUE;
return;
}
}
counter --;
}
else
{
BlockCodingInfo[BlockSeq].RefineBits.RefineChildren.ChildrenSymbolLength ++;
BlockCodingInfo[BlockSeq].RefineBits.RefineChildren.ChildrenRefSymbol += (1 << (3 - t));
}
t ++;
if ((PtrCoding->DecodingStopLocations.BitPlaneStopDecoding != -1)
&& PtrCoding->RateReached == TRUE && (!PtrCoding->DecodingStopLocations.LocationFind))
{
PtrCoding->DecodingStopLocations.BlockNoStopDecoding = BlockSeq;
PtrCoding->DecodingStopLocations.X_LocationStopDecoding = i;
PtrCoding->DecodingStopLocations.Y_LocationStopDecoding = p;
PtrCoding->DecodingStopLocations.LocationFind = TRUE;
return;
}
}
}
else
{
BlockCodingInfo[BlockSeq].RefineBits.RefineChildren.ChildrenSymbolLength += 4;
BlockCodingInfo[BlockSeq].RefineBits.RefineChildren.ChildrenRefSymbol += 0xF;
}
}
}
}
}
void StagesDeCodingGaggles3(StructCodingPara *PtrCoding,
BitPlaneBits *BlockCodingInfo,
UCHAR8 BlocksInGaggles,
UCHAR8 *CodeOptionsAllGaggles,
BOOL *FlagCodeOptionOutput)
{
UCHAR8 temp_x;
UCHAR8 temp_y;
UCHAR8 counter;
UINT32 BlockSeq;
short temp = 1;
int i;
int k;
int p;
DWORD32 temp_DWORD;
BOOL flag = FALSE;
UCHAR8 BitPlane = PtrCoding->BitPlane;
StrSymbolDetails StrSymbol;
for (BlockSeq = 0; BlockSeq < BlocksInGaggles; BlockSeq ++)
{
if (BlockCodingInfo[BlockSeq].BitMaxAC < BitPlane)
continue;
if (BlockCodingInfo[BlockSeq].StrPlaneHitHistory.TranB == 0)
continue;
// TranGi
if(PtrCoding->PtrHeader->Header.Part1.SegmentCount_8Bits == 28 && PtrCoding->BitPlane == 13
&& BlockSeq== 10)
BlockSeq = BlockSeq;
flag = FALSE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -