Здравствуйте.При ДКП сжатии картинки,она становится черно-белой.Не подскажите почему?Код функции прилагается
vector<color> DirectDTC(vector<color> lpSurface)// этап 3---->
{
double Cb, Cr;
double TmpCb[n][n], TmpCr[n][n];
vector<color> lpSurface2(lpSurface.size(),color(0,0,0));
CreateDCTMatrix();
for (int k = 0; k < lpSurface.size() / 64; k++)
{
vector <color> linuar;
for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++)
{
TmpCb[i][j] = 0.0;
TmpCr[i][j] = 0.0;
int index_ = k/2*(128)+(i*2+(k%2))*8;
for (int l = 0; l < 8; l++)
{
Cb = lpSurface[index_+l].x2;
Cr = lpSurface[index_+l].x3;
TmpCb[i][j] += double(Cb) * DTCT[l][j];
TmpCr[i][j] += double(Cr) * DTCT[l][j];
}
}
for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++)
{
double cb = 0.0, cr = 0.0;
for (int l = 0; l < 8; l++)
{
cb += DTC[i][l] * TmpCb[l][j];
cr += DTC[i][l] * TmpCr[l][j];
}
int index_ = k / 2 * (128) + (i * 2 + (k % 2)) * 8 + j;
double Yq = lpSurface[index_].x1;
double Cbq = cb / Q[i][j];
double Crq = cr / Q[i][j];
color nw = color(Yq, Cbq, Crq);
lpSurface2[index_] = nw;
linuar.push_back(lpSurface2[index_]);
}
/////////////////////////////////////////////////////////////////////
// Vector-doctor //
vector <color> linuar12(64,color()); // этап 4
for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++)
{
linuar12[Ziga[i][j]] = linuar[i*8+j];
}
////////////////////////////////////////////////////////////////////
// rle - real lipeck ekb //
//for (int i = 0; linuar12.size(); i++) {
//
//}
linuar.clear();
linuar12.clear();
}
return lpSurface2;
}