mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-22 15:43:46 +00:00
Cache the pixel computation for the cluster upon creation
This commit is contained in:
parent
4128bcf073
commit
6505944f57
2 changed files with 7 additions and 1 deletions
|
@ -254,7 +254,7 @@ double RGBACluster::QuantizedError(
|
|||
float totalError = 0.0;
|
||||
for(uint32 i = 0; i < GetNumPoints(); i++) {
|
||||
|
||||
const uint32 pixel = GetPoint(i).ToPixel();
|
||||
const uint32 pixel = GetPixel(i);
|
||||
const uint8 *pb = (const uint8 *)(&pixel);
|
||||
|
||||
float minError = FLT_MAX;
|
||||
|
|
|
@ -141,6 +141,7 @@ public:
|
|||
RGBAVector p = RGBAVector(i, pixels[i]);
|
||||
m_Avg += p;
|
||||
m_PointMap[m_NumPoints] = i;
|
||||
m_DataPixels[m_NumPoints] = p.ToPixel();
|
||||
m_DataPoints[m_NumPoints++] = p;
|
||||
|
||||
for(uint32 i = 0; i < kNumColorChannels; i++) {
|
||||
|
@ -156,6 +157,10 @@ public:
|
|||
return m_DataPoints[m_PointMap[idx]];
|
||||
}
|
||||
|
||||
const uint32 &GetPixel(int idx) const {
|
||||
return m_DataPixels[m_PointMap[idx]];
|
||||
}
|
||||
|
||||
uint32 GetNumPoints() const { return m_NumPoints; }
|
||||
RGBAVector GetAvg() const { return m_Avg; }
|
||||
|
||||
|
@ -219,6 +224,7 @@ public:
|
|||
|
||||
// The points in the cluster.
|
||||
RGBAVector m_DataPoints[kMaxNumDataPoints];
|
||||
uint32 m_DataPixels[kMaxNumDataPoints];
|
||||
uint8 m_PointMap[kMaxNumDataPoints];
|
||||
RGBAVector m_Min, m_Max;
|
||||
|
||||
|
|
Loading…
Reference in a new issue