/* * Decompression: void* ptr is a struct of AvgDCT to be filled with the * calculations performed on the AvgDCTScaled array in the closure. */ void applyDecompToAvgDCT(int col, int row, A2 toBeFilled, void* ptr, void* cl) { (void) toBeFilled; struct Closure *mycl = cl; struct AvgDCT* toBeSet = ptr; struct AvgDCTScaled* original = mycl->methods->at(mycl->array, col, row); toBeSet->pb = Arith40_chroma_of_index(original->pb); toBeSet->pr = Arith40_chroma_of_index(original->pr); toBeSet->a = ((float)(original->a))/511.0; toBeSet->b = ((float)(original->b))/50.0; toBeSet->c = ((float)(original->c))/50.0; toBeSet->d = ((float)(original->d))/50.0; }
/* Decompression: void* ptr is a struct of AvgDCT to be filled with the * calculations performed on the AvgDCTScaled array in the closure */ void applyDecompToAvgDCT(int col, int row, A2 toBeFilled, void* ptr, void* cl) { (void) toBeFilled; struct Closure *mycl = cl; struct AvgDCT* toBeSet = ptr; struct AvgDCTScaled* original = mycl->methods->at(mycl->array, col, row); toBeSet->pb = Arith40_chroma_of_index(original->pb); toBeSet->pr = Arith40_chroma_of_index(original->pr); toBeSet->a = ((float)(original->a))/511.0; toBeSet->b = ((float)(original->b))/50.0; toBeSet->c = ((float)(original->c))/50.0; toBeSet->d = ((float)(original->d))/50.0; //if(toBeSet->b > .300000) //printf("ToBeSet b is: %f, row: %d, col %d\n", toBeSet->b, row, col); //assert(toBeSet->b <= .300000 ); // assert( toBeSet->b >= -.300000); //assert(toBeSet->c <= .300000 || toBeSet->c >= -.300000); //assert(toBeSet->d >= -.300000 || toBeSet->d <= .300000); }
/* Takes in the 4-bit chroma index and returns the average Pb or Pr value */ float getChroma(unsigned x) { return Arith40_chroma_of_index(x); }