Skip to content

Commit 5b14d6b

Browse files
committed
only adjust QP once in each quantization-group for efficiency
1 parent 2aabe31 commit 5b14d6b

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

libde265/de265.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ void init_thread_context(thread_context* tctx)
451451
{
452452
// zero scrap memory for coefficient blocks
453453
memset(tctx->coeffBuf, 0, sizeof(tctx->coeffBuf));
454+
455+
tctx->currentQG_x = -1;
456+
tctx->currentQG_y = -1;
454457
}
455458

456459

libde265/transform.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,17 @@ void decode_quantization_parameters(decoder_context* ctx,
8383
int xQG = xC - (xC & ((1<<pps->Log2MinCuQpDeltaSize)-1));
8484
int yQG = yC - (yC & ((1<<pps->Log2MinCuQpDeltaSize)-1));
8585

86-
// if first QG in CU, remember last QPY of last CU previous QG
8786

88-
/*
89-
if (xQG == tctx->currentQG_x ||
90-
yQG == tctx->currentQG_y) { return; }
91-
*/
87+
// we only have to set QP in the first call in a quantization-group
88+
89+
if (xQG == tctx->currentQG_x &&
90+
yQG == tctx->currentQG_y)
91+
{
92+
return;
93+
}
94+
95+
96+
// if first QG in CU, remember last QPY of last CU previous QG
9297

9398
if (xQG != tctx->currentQG_x ||
9499
yQG != tctx->currentQG_y)

0 commit comments

Comments
 (0)