Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Gramner <gramner@twoorioles.com>2021-01-30 01:46:00 +0300
committerHenrik Gramner <henrik@gramner.com>2021-02-15 17:10:36 +0300
commit989057fb39f16dd2302fd6d55d86c4c5369475f1 (patch)
treeb79f0b570b38096def340082464bcbb80bdfb82c /src/decode.c
parenta92e307f17228d9bb3a98cfd3b025cefe469acb1 (diff)
Optimize non-qmatrix coefficient decoding
Not having a quantizer matrix is the most common case, so it's worth having a separate code path for it that eliminates some calculations and table lookups. Without a qm, not only can we skip calculating dq * qm, but only Exp-Golomb-coded coefficients will have the potential to overflow, so we can also skip clipping for the vast majority of coefficients.
Diffstat (limited to 'src/decode.c')
-rw-r--r--src/decode.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/decode.c b/src/decode.c
index 1314ce2..a308300 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -2966,15 +2966,13 @@ int dav1d_decode_frame(Dav1dFrameContext *const f) {
// setup dequant tables
init_quant_tables(f->seq_hdr, f->frame_hdr, f->frame_hdr->quant.yac, f->dq);
if (f->frame_hdr->quant.qm)
- for (int j = 0; j < N_RECT_TX_SIZES; j++) {
- f->qm[0][j][0] = dav1d_qm_tbl[f->frame_hdr->quant.qm_y][0][j];
- f->qm[0][j][1] = dav1d_qm_tbl[f->frame_hdr->quant.qm_u][1][j];
- f->qm[0][j][2] = dav1d_qm_tbl[f->frame_hdr->quant.qm_v][1][j];
- }
- for (int i = f->frame_hdr->quant.qm; i < 2; i++)
- for (int tx = 0; tx < N_RECT_TX_SIZES; tx++)
- for (int pl = 0; pl < 3; pl++)
- f->qm[i][tx][pl] = dav1d_qm_tbl[15][!!pl][tx];
+ for (int i = 0; i < N_RECT_TX_SIZES; i++) {
+ f->qm[i][0] = dav1d_qm_tbl[f->frame_hdr->quant.qm_y][0][i];
+ f->qm[i][1] = dav1d_qm_tbl[f->frame_hdr->quant.qm_u][1][i];
+ f->qm[i][2] = dav1d_qm_tbl[f->frame_hdr->quant.qm_v][1][i];
+ }
+ else
+ memset(f->qm, 0, sizeof(f->qm));
// setup jnt_comp weights
if (f->frame_hdr->switchable_comp_refs) {