/* Maybe we should rewrite this namespace blocks.
* I'm not sure */
public void DecodeCoeffs(ref short[] c)
{
if(buf == null)
return;
int[] bounds = {0,0,0};
if(par.no_ac) {
Unpack u = new Unpack(buf);
if(numX * numY == 1) {
bounds[1] = c.Length;
bounds[2] = frame.Width;
DecodeCodeBlock(ref c,u,bounds);
return;
}
for(int y = 0; y < numY; y++) {
for(int x = 0; x < numX; x++) {
if(u.DecodeBool())
continue;
if(par.codeblock_mode_index != 0)
qi += u.DecodeSint();
CalculateBounds(bounds,x,y);
DecodeCodeBlock(ref c,u,bounds);
}
}
} else {
Arithmetic a = new Arithmetic(buf);
if(numX * numY == 1) {
bounds[1] = c.Length;
bounds[2] = frame.Width;
DecodeCodeBlock(ref c, a, bounds);
return;
}
for(int y = 0; y < numY; y++) {
for(int x = 0; x < numX; x++) {
if(a.DecodeBool(Context.ZERO_CODEBLOCK))
continue;
if(par.codeblock_mode_index != 0)
qi += a.DecodeSint(Context.QUANTISER_CONT,
Context.QUANTISER_VALUE,
Context.QUANTISER_SIGN);
CalculateBounds(bounds, x, y);
DecodeCodeBlock(ref c, a, bounds);
}
}
}
}