[Codec] Get rid of the global. g_midpoint_prequant
//TODO: get rid of the global.
extern int g_midpoint_prequant; //HACK
Approach
- Create a context for internal -- Since an argument for processor dispatch has to be added, create a context for internal uses and store this midpoint pre-quantization value and dispatch table.
Code talk
So it would be like this:
// "CFHDInternalContext* ictx" is context for internal usage.
void QuantizeRow16sTo16s(CFHDInternalContext* ictx, PIXEL *input, PIXEL *output, int length, int divisor)
{
// ...
# if MIDPOINT_PREQUANT
int prequant_midpoint = 0;// divisor/2;
if(ictx->quantizer.g_midpoint_prequant >= 2 && ictx->quantizer.g_midpoint_prequant < 9) // Read from the private context.
{
prequant_midpoint = divisor / ictx->g_midpoint_prequant;
if(ictx->quantizer.g_midpoint_prequant == 2) //CFEncode_Premphasis_Original // Ditto.
{
if(prequant_midpoint)
prequant_midpoint--;
}
}
#endif
// ...