Skip to content

Commit

Permalink
fill 32x32 scaling matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Feb 23, 2021
1 parent dbff907 commit 7d5aeb5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
25 changes: 23 additions & 2 deletions libde265/sps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,10 @@ de265_error read_scaling_list(bitreader* br, const seq_parameter_set* sps,
int dc_coeff[4][6];

for (int sizeId=0;sizeId<4;sizeId++) {
int n = ((sizeId==3) ? 2 : 6);
//int n = ((sizeId==3) ? 2 : 6);
uint8_t scaling_list[6][32*32];

for (int matrixId=0;matrixId<n;matrixId++) {
for (int matrixId=0 ; matrixId<6 ; matrixId += (sizeId==3 ? 3 : 1)) {
uint8_t* curr_scaling_list = scaling_list[matrixId];
int scaling_list_dc_coef;

Expand Down Expand Up @@ -992,6 +992,27 @@ de265_error read_scaling_list(bitreader* br, const seq_parameter_set* sps,
}
}


// --- fill 32x32 matrices for chroma

const position* scan = get_scan_order(3, 0 /* diag */);

for (int matrixId=0;matrixId<6;matrixId++)
if (matrixId!=0 && matrixId!=3) {
for (int i=0;i<64;i++) {
int x = scan[i].x;
int y = scan[i].y;
int v = sclist->ScalingFactor_Size1[matrixId][y][x];

for (int dy=0;dy<4;dy++)
for (int dx=0;dx<4;dx++) {
sclist->ScalingFactor_Size3[matrixId][4*y+dy][4*x+dx] = v;
}
}

sclist->ScalingFactor_Size3[matrixId][0][0] = sclist->ScalingFactor_Size1[matrixId][0][0];
}

return DE265_OK;
}

Expand Down
2 changes: 1 addition & 1 deletion libde265/sps.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef struct scaling_list_data {
uint8_t ScalingFactor_Size0[6][4][4];
uint8_t ScalingFactor_Size1[6][8][8];
uint8_t ScalingFactor_Size2[6][16][16];
uint8_t ScalingFactor_Size3[2][32][32];
uint8_t ScalingFactor_Size3[6][32][32];
} scaling_list_data;


Expand Down
4 changes: 1 addition & 3 deletions libde265/transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,8 @@ void scale_coefficients_internal(thread_context* tctx,

for (int i=0;i<tctx->nCoeff[cIdx];i++) {
int pos = tctx->coeffPos[cIdx][i];
int x = pos%nT;
int y = pos/nT;

const int m_x_y = sclist[x+y*nT];
const int m_x_y = sclist[pos];
const int fact = m_x_y * levelScale[qP%6] << (qP/6);

int64_t currCoeff = tctx->coeffList[cIdx][i];
Expand Down

0 comments on commit 7d5aeb5

Please sign in to comment.