ref: 8863dabe0a500c9c641f546cd1ae3ac97b6312a1
parent: 265d0e6862eca0ac326208f67cfc7ef3682500b3
author: Sigrid Haflínudóttir <[email protected]>
date: Fri Sep 4 05:28:24 EDT 2020
remove useless traces
--- a/src/av19.c
+++ b/src/av19.c
@@ -8,7 +8,7 @@
{
Dav1dSettings av1s;
Dav1dContext *c;
- Dav1dPicture *p;
+ Dav1dPicture p;
Dav1dData data;
DemuxerContext *dc;
unsigned fps[2], timebase[2], total;
@@ -26,25 +26,21 @@
if(dav1d_open(&c, &av1s) != 0)
sysfatal("dav1d_open");
- //print("%d %d %d %d %d\n", fps[0], fps[1], timebase[0], timebase[1], total);
-
if(input_read(dc, &data) < 0)
sysfatal("input_read");
do{
- fprint(2, "sending\n");
+ fprint(2, "data.sz: %zd\n", data.sz);
+ memset(&p, 0, sizeof(p));
res = dav1d_send_data(c, &data);
- fprint(2, "sent, res is %d\n", res);
if(res < 0 && res != DAV1D_ERR(EAGAIN))
sysfatal("dav1d_send_data: %d", res);
- fprint(2, "getting a picture\n");
- p = calloc(1, sizeof(*p));
- if((res = dav1d_get_picture(c, p)) < 0){
+ fprint(2, "dav1d_send_data: %d\n", res);
+ if((res = dav1d_get_picture(c, &p)) < 0){
if(res != DAV1D_ERR(EAGAIN))
sysfatal("dav1d_get_picture");
}
- free(p);
-
+ fprint(2, "dav1d_get_picture: %d\n", res);
}while(data.sz > 0 || input_read(dc, &data) == 0);
if(data.sz > 0)
--- a/src/decode.c
+++ b/src/decode.c
@@ -719,7 +719,6 @@
(bw4 > ss_hor || t->bx & 1) &&
(bh4 > ss_ver || t->by & 1);
- fprintf(stderr, "decode_b %d\n", decode_b_index++);
if (f->frame_thread.pass == 2) {
if (b->intra) {
f->bd_fn.recon_b_intra(t, bs, intra_edge_flags, b);
@@ -888,14 +887,10 @@
}
// skip_mode
- if(seg)
- fprintf(stderr, "%d %d %d\n", seg->globalmv, seg->ref, seg->skip);
- fprintf(stderr, "%d %d\n", f->frame_hdr->skip_mode_enabled, imin(bw4, bh4));
if ((!seg || (!seg->globalmv && seg->ref == -1 && !seg->skip)) &&
f->frame_hdr->skip_mode_enabled && imin(bw4, bh4) > 1)
{
const int smctx = t->a->skip_mode[bx4] + t->l.skip_mode[by4];
- fprintf(stderr, "smctx=%d\n", smctx);
b->skip_mode = dav1d_msac_decode_bool_adapt(&ts->msac,
ts->cdf.m.skip_mode[smctx]);
if (DEBUG_BLOCK_INFO)
@@ -1050,17 +1045,14 @@
}
}
- fprintf(stderr, "skip=%d frame_type=%d\n", b->skip_mode, f->frame_hdr->frame_type);
if (b->skip_mode) {
b->intra = 0;
} else if (f->frame_hdr->frame_type & 1) {
- fprintf(stderr, "seg: %d\n", seg && (seg->ref >= 0 || seg->globalmv));
if (seg && (seg->ref >= 0 || seg->globalmv)) {
b->intra = !seg->ref;
} else {
const int ictx = get_intra_ctx(t->a, &t->l, by4, bx4,
have_top, have_left);
- fprintf(stderr, "ictx=%d\n", ictx);
b->intra = !dav1d_msac_decode_bool_adapt(&ts->msac,
ts->cdf.m.intra[ictx]);
if (DEBUG_BLOCK_INFO)
@@ -1220,7 +1212,6 @@
if (f->frame_hdr->txfm_mode == DAV1D_TX_SWITCHABLE && t_dim->max > TX_4X4) {
const int tctx = get_tx_ctx(t->a, &t->l, t_dim, by4, bx4);
uint16_t *const tx_cdf = ts->cdf.m.txsz[t_dim->max - 1][tctx];
- fprintf(stderr, "==> %d %d\n", t_dim->max - 1, tctx);
int depth = dav1d_msac_decode_symbol_adapt4(&ts->msac, tx_cdf,
imin(t_dim->max, 2));
@@ -1438,7 +1429,6 @@
{
const int ctx = get_comp_ctx(t->a, &t->l, by4, bx4,
have_top, have_left);
- fprintf(stderr, "comp_ctx=%d\n", ctx);
is_comp = dav1d_msac_decode_bool_adapt(&ts->msac,
ts->cdf.m.comp[ctx]);
if (DEBUG_BLOCK_INFO)
@@ -1474,7 +1464,6 @@
} else if (is_comp) {
const int dir_ctx = get_comp_dir_ctx(t->a, &t->l, by4, bx4,
have_top, have_left);
- fprintf(stderr, "dir_ctx=%d\n", dir_ctx);
if (dav1d_msac_decode_bool_adapt(&ts->msac,
ts->cdf.m.comp_dir[dir_ctx]))
{
@@ -1616,7 +1605,6 @@
int is_segwedge = 0;
if (f->seq_hdr->masked_compound) {
const int mask_ctx = get_mask_comp_ctx(t->a, &t->l, by4, bx4);
- fprintf(stderr, "mask_ctx=%d\n", mask_ctx);
is_segwedge = dav1d_msac_decode_bool_adapt(&ts->msac,
ts->cdf.m.mask_comp[mask_ctx]);
@@ -1633,7 +1621,6 @@
f->refp[b->ref[0]].p.frame_hdr->frame_offset,
f->refp[b->ref[1]].p.frame_hdr->frame_offset,
t->a, &t->l, by4, bx4);
- fprintf(stderr, "jnt_ctx=%d %d %d %d\n", jnt_ctx, f->cur.frame_hdr->frame_offset, f->refp[b->ref[0]].p.frame_hdr->frame_offset, f->refp[b->ref[1]].p.frame_hdr->frame_offset);
b->comp_type = COMP_INTER_WEIGHTED_AVG +
dav1d_msac_decode_bool_adapt(&ts->msac,
ts->cdf.m.jnt_comp[jnt_ctx]);
@@ -1896,7 +1883,6 @@
const int comp = b->comp_type != COMP_INTER_NONE;
const int ctx1 = get_filter_ctx(t->a, &t->l, comp, 0, b->ref[0],
by4, bx4);
- fprintf(stderr, "ctx1=%d\n", ctx1);
filter[0] = dav1d_msac_decode_symbol_adapt4(&ts->msac,
ts->cdf.m.filter[0][ctx1],
DAV1D_N_SWITCHABLE_FILTERS - 1);
@@ -1977,7 +1963,7 @@
rep_macro(type, t->dir filter[1], off, mul * filter[1]); \
rep_macro(type, t->dir mode, off, mul * b->inter_mode); \
rep_macro(type, t->dir ref[0], off, mul * b->ref[0]); \
- rep_macro(type, t->dir ref[1], off, mul * b->ref[1])
+ rep_macro(type, t->dir ref[1], off, mul * ((uint8_t) b->ref[1]))
case_set(bh4, l., 1, by4);
case_set(bw4, a->, 0, bx4);
#undef set_ctx
@@ -2534,7 +2520,6 @@
const int col_sb_start = f->frame_hdr->tiling.col_start_sb[tile_col];
const int col_sb128_start = col_sb_start >> !f->seq_hdr->sb128;
- fprintf(stderr, "%d %d %d %d %d\n", root_bl, sb_step, tile_row, col_sb_start, col_sb128_start);
if ((f->frame_hdr->frame_type & 1) || f->frame_hdr->allow_intrabc) {
dav1d_refmvs_tile_sbrow_init(&t->rt, &f->rf, ts->tiling.col_start,
ts->tiling.col_end, ts->tiling.row_start,
@@ -2557,7 +2542,6 @@
f->bd_fn.backup_ipred_edge(t);
return 0;
}
- fprintf(stderr, "%d\n", ts->msac.cnt);
// error out on symbol decoder overread
if (ts->msac.cnt < -15) return 1;
@@ -2995,11 +2979,9 @@
if (f->frame_hdr->switchable_comp_refs) {
for (int i = 0; i < 7; i++) {
const unsigned ref0poc = f->refp[i].p.frame_hdr->frame_offset;
- fprintf(stderr, "ref0poc=%u\n", ref0poc);
for (int j = i + 1; j < 7; j++) {
const unsigned ref1poc = f->refp[j].p.frame_hdr->frame_offset;
- fprintf(stderr, "ref1poc=%u\n", ref1poc);
const unsigned d1 =
imin(abs(get_poc_diff(f->seq_hdr->order_hint_n_bits, ref0poc,
@@ -3008,7 +2990,6 @@
imin(abs(get_poc_diff(f->seq_hdr->order_hint_n_bits, ref1poc,
f->cur.frame_hdr->frame_offset)), 31);
const int order = d0 <= d1;
- fprintf(stderr, "d0=%u d1=%u\n", d0, d1);
static const uint8_t quant_dist_weight[3][2] = {
{ 2, 3 }, { 2, 5 }, { 2, 7 }
@@ -3133,7 +3114,7 @@
for (int tile_col = 0; tile_col < f->frame_hdr->tiling.cols; tile_col++) {
t->ts = &f->ts[tile_row * f->frame_hdr->tiling.cols + tile_col];
- if (dav1d_decode_tile_sbrow(t)) { fprintf(stderr, "dav1d_decode_tile_sbrow failed\n"); goto error; }
+ if (dav1d_decode_tile_sbrow(t)) goto error;
}
if (f->frame_thread.pass <= 1 && f->frame_hdr->frame_type & 1) {
dav1d_refmvs_save_tmvs(&t->rt, 0, f->bw >> 1, t->by >> 1, by_end);
@@ -3620,7 +3601,7 @@
dav1d_ref_dec(&c->refs[i].refmvs);
}
}
- return res;
+ return res;
}
} else {
pthread_cond_signal(&f->frame_thread.td.cond);
--- a/src/env.h
+++ b/src/env.h
@@ -72,17 +72,11 @@
}
}
-static inline int RET(int x) {
- fprintf(stderr, "XX~~> %d\n", x);
- return x;
-}
-
static inline int get_tx_ctx(const BlockContext *const a,
const BlockContext *const l,
const TxfmInfo *const max_tx,
const int yb4, const int xb4)
{
- fprintf(stderr, "~~> %d %d %d %d %d %d\n", (int)l->tx_intra[yb4], max_tx->lh, a->tx_intra[xb4], max_tx->lw, yb4, xb4);
return ((int)l->tx_intra[yb4] >= (int)max_tx->lh) + ((int)a->tx_intra[xb4] >= (int)max_tx->lw);
}
@@ -171,19 +165,19 @@
return 4;
} else {
// 4U means intra (-1) or bwd (>= 4)
- return RET(2 + ((unsigned)l->ref[0][yb4] >= 4U));
+ return 2 + ((unsigned)l->ref[0][yb4] >= 4U);
}
} else if (l->comp_type[yb4]) {
// 4U means intra (-1) or bwd (>= 4)
- return RET(2 + ((unsigned)a->ref[0][xb4] >= 4U));
+ return 2 + ((unsigned)a->ref[0][xb4] >= 4U);
} else {
- return RET((l->ref[0][yb4] >= 4) ^ (a->ref[0][xb4] >= 4));
+ return (l->ref[0][yb4] >= 4) ^ (a->ref[0][xb4] >= 4);
}
} else {
- return RET(a->comp_type[xb4] ? 3 : a->ref[0][xb4] >= 4);
+ return a->comp_type[xb4] ? 3 : a->ref[0][xb4] >= 4;
}
} else if (have_left) {
- return RET(l->comp_type[yb4] ? 3 : l->ref[0][yb4] >= 4);
+ return l->comp_type[yb4] ? 3 : l->ref[0][yb4] >= 4;
} else {
return 1;
}
@@ -206,7 +200,7 @@
const int off = a_intra ? yb4 : xb4;
if (edge->comp_type[off] == COMP_INTER_NONE) return 2;
- return RET(1 + 2 * has_uni_comp(edge, off));
+ return 1 + 2 * has_uni_comp(edge, off);
}
const int a_comp = a->comp_type[xb4] != COMP_INTER_NONE;
@@ -214,19 +208,19 @@
const int a_ref0 = a->ref[0][xb4], l_ref0 = l->ref[0][yb4];
if (!a_comp && !l_comp) {
- return RET(1 + 2 * ((a_ref0 >= 4) == (l_ref0 >= 4)));
+ return 1 + 2 * ((a_ref0 >= 4) == (l_ref0 >= 4));
} else if (!a_comp || !l_comp) {
const BlockContext *const edge = a_comp ? a : l;
const int off = a_comp ? xb4 : yb4;
if (!has_uni_comp(edge, off)) return 1;
- return RET(3 + ((a_ref0 >= 4) == (l_ref0 >= 4)));
+ return 3 + ((a_ref0 >= 4) == (l_ref0 >= 4));
} else {
const int a_uni = has_uni_comp(a, xb4), l_uni = has_uni_comp(l, yb4);
if (!a_uni && !l_uni) return 0;
if (!a_uni || !l_uni) return 2;
- return RET(3 + ((a_ref0 == 4) == (l_ref0 == 4)));
+ return 3 + ((a_ref0 == 4) == (l_ref0 == 4));
}
} else if (have_top || have_left) {
const BlockContext *const edge = have_left ? l : a;
@@ -234,7 +228,7 @@
if (edge->intra[off]) return 2;
if (edge->comp_type[off] == COMP_INTER_NONE) return 2;
- return RET(4 * has_uni_comp(edge, off));
+ return 4 * has_uni_comp(edge, off);
} else {
return 2;
}
@@ -263,8 +257,6 @@
a->ref[0][xb4] == 6;
const int l_ctx = l->comp_type[yb4] >= COMP_INTER_AVG ||
l->ref[0][yb4] == 6;
- fprintf(stderr, "40~~> %d\n", a_ctx);
- fprintf(stderr, "41~~> %d\n", l_ctx);
return 3 * offset + a_ctx + l_ctx;
}
@@ -277,8 +269,6 @@
a->ref[0][xb4] == 6 ? 3 : 0;
const int l_ctx = l->comp_type[yb4] >= COMP_INTER_SEG ? 1 :
l->ref[0][yb4] == 6 ? 3 : 0;
- fprintf(stderr, "30~~> %d\n", a_ctx);
- fprintf(stderr, "31~~> %d\n", l_ctx);
return imin(a_ctx + l_ctx, 5);
}
@@ -299,16 +289,12 @@
int cnt[2] = { 0 };
if (have_top && !a->intra[xb4]) {
- fprintf(stderr, "20~~> %d\n", a->ref[0][xb4] >= 4);
cnt[a->ref[0][xb4] >= 4]++;
- fprintf(stderr, "21~~> %d\n", a->ref[1][xb4] >= 4);
if (a->comp_type[xb4]) cnt[a->ref[1][xb4] >= 4]++;
}
if (have_left && !l->intra[yb4]) {
- fprintf(stderr, "22~~> %d\n", l->ref[0][yb4] >= 4);
cnt[l->ref[0][yb4] >= 4]++;
- fprintf(stderr, "23~~> %d\n", l->ref[1][yb4] >= 4);
if (l->comp_type[yb4]) cnt[l->ref[1][yb4] >= 4]++;
}
@@ -323,16 +309,12 @@
int cnt[4] = { 0 };
if (have_top && !a->intra[xb4]) {
- fprintf(stderr, "10~~> %d\n", a->ref[0][xb4] < 4);
if (a->ref[0][xb4] < 4) cnt[a->ref[0][xb4]]++;
- fprintf(stderr, "11~~> %d\n", a->comp_type[xb4] && a->ref[1][xb4] < 4);
if (a->comp_type[xb4] && a->ref[1][xb4] < 4) cnt[a->ref[1][xb4]]++;
}
if (have_left && !l->intra[yb4]) {
- fprintf(stderr, "12~~> %d\n", l->ref[0][yb4] < 4);
if (l->ref[0][yb4] < 4) cnt[l->ref[0][yb4]]++;
- fprintf(stderr, "13~~> %d\n", l->comp_type[yb4] && l->ref[1][yb4] < 4);
if (l->comp_type[yb4] && l->ref[1][yb4] < 4) cnt[l->ref[1][yb4]]++;
}
@@ -350,16 +332,12 @@
int cnt[2] = { 0 };
if (have_top && !a->intra[xb4]) {
- fprintf(stderr, "00~~> %d\n", a->ref[0][xb4] < 2);
if (a->ref[0][xb4] < 2) cnt[a->ref[0][xb4]]++;
- fprintf(stderr, "01~~> %d\n", a->comp_type[xb4] && a->ref[1][xb4] < 2);
if (a->comp_type[xb4] && a->ref[1][xb4] < 2) cnt[a->ref[1][xb4]]++;
}
if (have_left && !l->intra[yb4]) {
- fprintf(stderr, "02~~> %d\n", l->ref[0][yb4] < 2);
if (l->ref[0][yb4] < 2) cnt[l->ref[0][yb4]]++;
- fprintf(stderr, "03~~> %d\n", l->comp_type[yb4] && l->ref[1][yb4] < 2);
if (l->comp_type[yb4] && l->ref[1][yb4] < 2) cnt[l->ref[1][yb4]]++;
}
@@ -374,15 +352,11 @@
int cnt[2] = { 0 };
if (have_top && !a->intra[xb4]) {
- fprintf(stderr, "A0~~> %d\n", (a->ref[0][xb4] ^ 2U) < 2);
- fprintf(stderr, "A1~~> %d\n", a->comp_type[xb4] && (a->ref[1][xb4] ^ 2U) < 2);
if ((a->ref[0][xb4] ^ 2U) < 2) cnt[a->ref[0][xb4] - 2]++;
if (a->comp_type[xb4] && (a->ref[1][xb4] ^ 2U) < 2) cnt[a->ref[1][xb4] - 2]++;
}
if (have_left && !l->intra[yb4]) {
- fprintf(stderr, "A2~~> %d\n", (l->ref[0][yb4] ^ 2U) < 2);
- fprintf(stderr, "A3~~> %d\n", l->comp_type[yb4] && (l->ref[1][yb4] ^ 2U) < 2);
if ((l->ref[0][yb4] ^ 2U) < 2) cnt[l->ref[0][yb4] - 2]++;
if (l->comp_type[yb4] && (l->ref[1][yb4] ^ 2U) < 2) cnt[l->ref[1][yb4] - 2]++;
}
@@ -398,16 +372,12 @@
int cnt[3] = { 0 };
if (have_top && !a->intra[xb4]) {
- fprintf(stderr, "B0~~> %d\n", a->ref[0][xb4] >= 4);
if (a->ref[0][xb4] >= 4) cnt[a->ref[0][xb4] - 4]++;
- fprintf(stderr, "B1~~> %d\n", a->comp_type[xb4] && (int)a->ref[1][xb4] >= 4);
if (a->comp_type[xb4] && a->ref[1][xb4] >= 4) cnt[a->ref[1][xb4] - 4]++;
}
if (have_left && !l->intra[yb4]) {
- fprintf(stderr, "B2~~> %d\n", l->ref[0][yb4] >= 4);
if (l->ref[0][yb4] >= 4) cnt[l->ref[0][yb4] - 4]++;
- fprintf(stderr, "B3~~> %d\n", l->comp_type[yb4] && l->ref[1][yb4] >= 44);
if (l->comp_type[yb4] && l->ref[1][yb4] >= 4) cnt[l->ref[1][yb4] - 4]++;
}
@@ -424,16 +394,12 @@
int cnt[3] = { 0 };
if (have_top && !a->intra[xb4]) {
- fprintf(stderr, "C0~~> %d\n", a->ref[0][xb4] >= 4);
if (a->ref[0][xb4] >= 4) cnt[a->ref[0][xb4] - 4]++;
- fprintf(stderr, "C1~~> %d\n", a->comp_type[xb4] && a->ref[1][xb4] >= 4);
if (a->comp_type[xb4] && a->ref[1][xb4] >= 4) cnt[a->ref[1][xb4] - 4]++;
}
if (have_left && !l->intra[yb4]) {
- fprintf(stderr, "C2~~> %d\n", a->ref[0][xb4] >= 4);
if (l->ref[0][yb4] >= 4) cnt[l->ref[0][yb4] - 4]++;
- fprintf(stderr, "C3~~> %d\n", l->comp_type[yb4] && l->ref[1][yb4] >= 4);
if (l->comp_type[yb4] && l->ref[1][yb4] >= 4) cnt[l->ref[1][yb4] - 4]++;
}
@@ -448,16 +414,12 @@
int cnt[3] = { 0 };
if (have_top && !a->intra[xb4]) {
- fprintf(stderr, "D0~~> %d\n", a->ref[0][xb4] - 1U < 3);
if (a->ref[0][xb4] - 1U < 3) cnt[a->ref[0][xb4] - 1]++;
- fprintf(stderr, "D1~~> %d\n", a->comp_type[xb4] && a->ref[1][xb4] - 1U < 3);
if (a->comp_type[xb4] && a->ref[1][xb4] - 1U < 3) cnt[a->ref[1][xb4] - 1]++;
}
if (have_left && !l->intra[yb4]) {
- fprintf(stderr, "D2~~> %d\n", l->ref[0][yb4] - 1U < 3);
if (l->ref[0][yb4] - 1U < 3) cnt[l->ref[0][yb4] - 1]++;
- fprintf(stderr, "D3~~> %d\n", l->comp_type[yb4] && l->ref[1][yb4] - 1U < 3);
if (l->comp_type[yb4] && l->ref[1][yb4] - 1U < 3) cnt[l->ref[1][yb4] - 1]++;
}
@@ -534,7 +496,7 @@
gmv->matrix[4] * x + gmv->matrix[1];
const int shift = 16 - (3 - !hdr->hp);
const int round = (1 << shift) >> 1;
- mv res;
+ mv res = {0};
res.y = apply_sign(((abs(yc) + round) >> shift) << !hdr->hp, yc);
res.x = apply_sign(((abs(xc) + round) >> shift) << !hdr->hp, xc);
if (hdr->force_integer_mv)
@@ -542,7 +504,7 @@
return res;
}
case DAV1D_WM_TYPE_TRANSLATION: {
- mv res;
+ mv res = {0};
res.y = gmv->matrix[0] >> 13;
res.x = gmv->matrix[1] >> 13;
if (hdr->force_integer_mv)
@@ -550,9 +512,7 @@
return res;
}
case DAV1D_WM_TYPE_IDENTITY: {
- mv res;
- res.x = 0;
- res.y = 0;
+ mv res = {0};
return res;
}
}
--- a/src/lib.c
+++ b/src/lib.c
@@ -247,7 +247,6 @@
while (buf.sz > 0) {
res = dav1d_parse_obus(c, &buf, 1);
- fprintf(stderr, "res=%d\n", res);
if (res < 0) goto error;
assert((size_t)res <= buf.sz);
@@ -366,7 +365,6 @@
while (in->sz > 0) {
res = dav1d_parse_obus(c, in, 0);
- fprintf(stderr, "res=%d\n", res);
if (res < 0) {
dav1d_data_unref_internal(in);
} else {
--- a/src/msac.c
+++ b/src/msac.c
@@ -41,7 +41,7 @@
static inline void ctx_refill(MsacContext *const s) {
const uint8_t *buf_pos = s->buf_pos;
const uint8_t *buf_end = s->buf_end;
- int c = (int)EC_WIN_SIZE - s->cnt - 24;
+ int c = EC_WIN_SIZE - s->cnt - 24;
ec_win dif = s->dif;
while (c >= 0 && buf_pos < buf_end) {
dif ^= ((ec_win)*buf_pos++) << c;
@@ -48,8 +48,7 @@
c -= 8;
}
s->dif = dif;
- //fprint(2, "cnt: %d -> %d\n", s->cnt, EC_WIN_SIZE - c - 24);
- s->cnt = (int)EC_WIN_SIZE - c - 24;
+ s->cnt = EC_WIN_SIZE - c - 24;
s->buf_pos = buf_pos;
}
@@ -135,14 +134,10 @@
v = r * (cdf[val] >> EC_PROB_SHIFT);
v >>= 7 - EC_PROB_SHIFT;
v += EC_MIN_PROB * ((unsigned)n_symbols - val);
- fprint(2, ". %ud %ud %ud %ud %ud\n", val, cdf[val], r, c, v);
} while (c < v);
assert(u <= s->rng);
- fprintf(stderr, "!3 %zd %ud -> %ud\n", n_symbols, s->rng, v);
- //if(s->rng == 33215)
- // *(uint8_t*)0 = 0;
ctx_norm(s, s->dif - ((ec_win)v << (EC_WIN_SIZE - 16)), u - v);
if (s->allow_update_cdf) {
--- a/src/obu.c
+++ b/src/obu.c
@@ -48,7 +48,7 @@
static int parse_seq_hdr(Dav1dContext *const c, GetBits *const gb,
Dav1dSequenceHeader *const hdr)
{
-#define DEBUG_SEQ_HDR 1
+#define DEBUG_SEQ_HDR 0
#if DEBUG_SEQ_HDR
const unsigned init_bit_pos = dav1d_get_bits_pos(gb);
@@ -57,7 +57,7 @@
hdr->profile = dav1d_get_bits(gb, 3);
if (hdr->profile > 2) goto error;
#if DEBUG_SEQ_HDR
- fprintf(stderr, "SEQHDR: post-profile: off=%ld\n",
+ printf("SEQHDR: post-profile: off=%ld\n",
dav1d_get_bits_pos(gb) - init_bit_pos);
#endif
@@ -65,7 +65,7 @@
hdr->reduced_still_picture_header = dav1d_get_bits(gb, 1);
if (hdr->reduced_still_picture_header && !hdr->still_picture) goto error;
#if DEBUG_SEQ_HDR
- fprintf(stderr, "SEQHDR: post-stillpicture_flags: off=%ld\n",
+ printf("SEQHDR: post-stillpicture_flags: off=%ld\n",
dav1d_get_bits_pos(gb) - init_bit_pos);
#endif
@@ -104,7 +104,7 @@
hdr->decoder_model_info_present = 0;
}
#if DEBUG_SEQ_HDR
- fprintf(stderr, "SEQHDR: post-timinginfo: off=%ld\n",
+ printf("SEQHDR: post-timinginfo: off=%ld\n",
dav1d_get_bits_pos(gb) - init_bit_pos);
#endif
@@ -138,7 +138,7 @@
c->operating_point < hdr->num_operating_points ? c->operating_point : 0;
c->operating_point_idc = hdr->operating_points[op_idx].idc;
#if DEBUG_SEQ_HDR
- fprintf(stderr, "SEQHDR: post-operating-points: off=%ld\n",
+ printf("SEQHDR: post-operating-points: off=%ld\n",
dav1d_get_bits_pos(gb) - init_bit_pos);
#endif
}
@@ -148,7 +148,7 @@
hdr->max_width = dav1d_get_bits(gb, hdr->width_n_bits) + 1;
hdr->max_height = dav1d_get_bits(gb, hdr->height_n_bits) + 1;
#if DEBUG_SEQ_HDR
- fprintf(stderr, "SEQHDR: post-size: off=%ld\n",
+ printf("SEQHDR: post-size: off=%ld\n",
dav1d_get_bits_pos(gb) - init_bit_pos);
#endif
hdr->frame_id_numbers_present =
@@ -158,7 +158,7 @@
hdr->frame_id_n_bits = dav1d_get_bits(gb, 3) + hdr->delta_frame_id_n_bits + 1;
}
#if DEBUG_SEQ_HDR
- fprintf(stderr, "SEQHDR: post-frame-id-numbers-present: off=%ld\n",
+ printf("SEQHDR: post-frame-id-numbers-present: off=%ld\n",
dav1d_get_bits_pos(gb) - init_bit_pos);
#endif
@@ -192,7 +192,7 @@
}
hdr->screen_content_tools = dav1d_get_bits(gb, 1) ? DAV1D_ADAPTIVE : dav1d_get_bits(gb, 1);
#if DEBUG_SEQ_HDR
- fprintf(stderr, "SEQHDR: post-screentools: off=%ld\n",
+ printf("SEQHDR: post-screentools: off=%ld\n",
dav1d_get_bits_pos(gb) - init_bit_pos);
#endif
hdr->force_integer_mv = hdr->screen_content_tools ?
@@ -204,7 +204,7 @@
hdr->cdef = dav1d_get_bits(gb, 1);
hdr->restoration = dav1d_get_bits(gb, 1);
#if DEBUG_SEQ_HDR
- fprintf(stderr, "SEQHDR: post-featurebits: off=%ld\n",
+ printf("SEQHDR: post-featurebits: off=%ld\n",
dav1d_get_bits_pos(gb) - init_bit_pos);
#endif
@@ -264,13 +264,13 @@
}
hdr->separate_uv_delta_q = !hdr->monochrome && dav1d_get_bits(gb, 1);
#if DEBUG_SEQ_HDR
- fprintf(stderr, "SEQHDR: post-colorinfo: off=%ld\n",
+ printf("SEQHDR: post-colorinfo: off=%ld\n",
dav1d_get_bits_pos(gb) - init_bit_pos);
#endif
hdr->film_grain_present = dav1d_get_bits(gb, 1);
#if DEBUG_SEQ_HDR
- fprintf(stderr, "SEQHDR: post-filmgrain: off=%ld\n",
+ printf("SEQHDR: post-filmgrain: off=%ld\n",
dav1d_get_bits_pos(gb) - init_bit_pos);
#endif
@@ -356,7 +356,7 @@
};
static int parse_frame_hdr(Dav1dContext *const c, GetBits *const gb) {
-#define DEBUG_FRAME_HDR 1
+#define DEBUG_FRAME_HDR 0
#if DEBUG_FRAME_HDR
const uint8_t *const init_ptr = gb->ptr;
@@ -367,7 +367,7 @@
hdr->show_existing_frame =
!seqhdr->reduced_still_picture_header && dav1d_get_bits(gb, 1);
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-show_existing_frame: off=%ld\n",
+ printf("HDR: post-show_existing_frame: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
if (hdr->show_existing_frame) {
@@ -391,7 +391,7 @@
hdr->frame_type == DAV1D_FRAME_TYPE_SWITCH ||
seqhdr->reduced_still_picture_header || dav1d_get_bits(gb, 1);
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-frametype_bits: off=%ld\n",
+ printf("HDR: post-frametype_bits: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
hdr->disable_cdf_update = dav1d_get_bits(gb, 1);
@@ -412,12 +412,11 @@
hdr->frame_size_override = seqhdr->reduced_still_picture_header ? 0 :
hdr->frame_type == DAV1D_FRAME_TYPE_SWITCH ? 1 : dav1d_get_bits(gb, 1);
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-frame_size_override_flag: off=%ld\n",
+ printf("HDR: post-frame_size_override_flag: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
hdr->frame_offset = seqhdr->order_hint ?
dav1d_get_bits(gb, seqhdr->order_hint_n_bits) : 0;
- fprintf(stderr, "1 frame_offset=%d %d %d\n", hdr->frame_offset, seqhdr->order_hint, seqhdr->order_hint_n_bits);
hdr->primary_ref_frame = !hdr->error_resilient_mode && hdr->frame_type & 1 ?
dav1d_get_bits(gb, 3) : DAV1D_PRIMARY_REF_NONE;
@@ -463,7 +462,6 @@
hdr->refidx[1] = hdr->refidx[2] = -1;
hdr->refidx[3] = dav1d_get_bits(gb, 3);
hdr->refidx[4] = hdr->refidx[5] = hdr->refidx[6] = -1;
- fprintf(stderr, "hdr set\n");
int shifted_frame_offset[8];
const int current_frame_offset = 1 << (seqhdr->order_hint_n_bits - 1);
@@ -473,7 +471,6 @@
get_poc_diff(seqhdr->order_hint_n_bits,
c->refs[i].p.p.frame_hdr->frame_offset,
hdr->frame_offset);
- fprintf(stderr, "shifted_frame_offset[%d]=%d\n", i, shifted_frame_offset[i]);
}
int used_frame[8] = { 0 };
@@ -490,7 +487,6 @@
latest_frame_offset = hint;
}
}
- fprintf(stderr, "refidx[6]=%d\n", hdr->refidx[6]);
if (latest_frame_offset != -1)
used_frame[hdr->refidx[6]] = 1;
@@ -529,7 +525,6 @@
hint >= latest_frame_offset)
{
hdr->refidx[i] = j;
- fprintf(stderr, "refidx[%d] <- %d\n", i, j);
latest_frame_offset = hint;
}
}
@@ -548,16 +543,13 @@
}
}
for (int i = 0; i < 7; i++) {
- if (hdr->refidx[i] < 0){
+ if (hdr->refidx[i] < 0)
hdr->refidx[i] = ref;
- fprintf(stderr, "!refidx[%d] <- %d\n", i, ref);
- }
}
}
for (int i = 0; i < 7; i++) {
if (!hdr->frame_ref_short_signaling){
hdr->refidx[i] = dav1d_get_bits(gb, 3);
- fprintf(stderr, ">refidx[%d] <- %d\n", i, hdr->refidx[i]);
}
if (seqhdr->frame_id_numbers_present)
dav1d_get_bits(gb, seqhdr->delta_frame_id_n_bits);
@@ -574,7 +566,7 @@
hdr->frame_type & 1 && dav1d_get_bits(gb, 1);
}
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-frametype-specific-bits: off=%ld\n",
+ printf("HDR: post-frametype-specific-bits: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -581,7 +573,7 @@
hdr->refresh_context = !seqhdr->reduced_still_picture_header &&
!hdr->disable_cdf_update && !dav1d_get_bits(gb, 1);
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-refresh_context: off=%ld\n",
+ printf("HDR: post-refresh_context: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -655,7 +647,7 @@
hdr->tiling.n_bytes = hdr->tiling.update = 0;
}
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-tiling: off=%ld\n",
+ printf("HDR: post-tiling: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -678,7 +670,7 @@
}
}
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-quant: off=%ld\n",
+ printf("HDR: post-quant: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
hdr->quant.qm = dav1d_get_bits(gb, 1);
@@ -690,7 +682,7 @@
hdr->quant.qm_u;
}
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-qm: off=%ld\n",
+ printf("HDR: post-qm: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -775,7 +767,7 @@
hdr->segmentation.seg_data.d[i].ref = -1;
}
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-segmentation: off=%ld\n",
+ printf("HDR: post-segmentation: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -787,7 +779,7 @@
hdr->delta.lf.res_log2 = hdr->delta.lf.present ? dav1d_get_bits(gb, 2) : 0;
hdr->delta.lf.multi = hdr->delta.lf.present ? dav1d_get_bits(gb, 1) : 0;
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-delta_q_lf_flags: off=%ld\n",
+ printf("HDR: post-delta_q_lf_flags: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -847,7 +839,7 @@
}
}
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-lpf: off=%ld\n",
+ printf("HDR: post-lpf: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -866,7 +858,7 @@
hdr->cdef.uv_strength[0] = 0;
}
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-cdef: off=%ld\n",
+ printf("HDR: post-cdef: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -908,7 +900,7 @@
hdr->restoration.type[2] = DAV1D_RESTORATION_NONE;
}
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-restoration: off=%ld\n",
+ printf("HDR: post-restoration: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -915,18 +907,17 @@
hdr->txfm_mode = hdr->all_lossless ? DAV1D_TX_4X4_ONLY :
dav1d_get_bits(gb, 1) ? DAV1D_TX_SWITCHABLE : DAV1D_TX_LARGEST;
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-txfmmode: off=%ld\n",
+ printf("HDR: post-txfmmode: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
hdr->switchable_comp_refs = hdr->frame_type & 1 ? dav1d_get_bits(gb, 1) : 0;
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-refmode: off=%ld\n",
+ printf("HDR: post-refmode: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
hdr->skip_mode_allowed = 0;
if (hdr->switchable_comp_refs && hdr->frame_type & 1 && seqhdr->order_hint) {
const unsigned poc = hdr->frame_offset;
- fprintf(stderr, "poc=%ud\n", poc);
unsigned off_before = 0xFFFFFFFFU;
int off_after = -1;
int off_before_idx = 0, off_after_idx = 0;;
@@ -935,7 +926,6 @@
const unsigned refpoc = c->refs[hdr->refidx[i]].p.p.frame_hdr->frame_offset;
const int diff = get_poc_diff(seqhdr->order_hint_n_bits, refpoc, poc);
- fprintf(stderr, "%d diff=%d (%d %d %d) %d\n", i, diff, seqhdr->order_hint_n_bits, refpoc, poc, hdr->refidx[i]);
if (diff > 0) {
if (off_after == -1 || get_poc_diff(seqhdr->order_hint_n_bits,
off_after, refpoc) > 0)
@@ -952,7 +942,6 @@
}
}
- fprintf(stderr, "X %x %d\n", off_before, off_after);
if (off_before != 0xFFFFFFFFU && off_after != -1) {
hdr->skip_mode_refs[0] = imin(off_before_idx, off_after_idx);
hdr->skip_mode_refs[1] = imax(off_before_idx, off_after_idx);
@@ -982,22 +971,20 @@
}
}
}
- fprintf(stderr, "skip_enabled %d -> ", hdr->skip_mode_allowed);
hdr->skip_mode_enabled = hdr->skip_mode_allowed ? dav1d_get_bits(gb, 1) : 0;
- fprintf(stderr, "%d\n", hdr->skip_mode_enabled);
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-extskip: off=%ld\n",
+ printf("HDR: post-extskip: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
hdr->warp_motion = !hdr->error_resilient_mode && hdr->frame_type & 1 &&
seqhdr->warped_motion && dav1d_get_bits(gb, 1);
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-warpmotionbit: off=%ld\n",
+ printf("HDR: post-warpmotionbit: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
hdr->reduced_txtp_set = dav1d_get_bits(gb, 1);
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-reducedtxtpset: off=%ld\n",
+ printf("HDR: post-reducedtxtpset: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -1051,7 +1038,7 @@
}
}
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-gmv: off=%ld\n",
+ printf("HDR: post-gmv: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -1135,7 +1122,7 @@
memset(&hdr->film_grain.data, 0, sizeof(hdr->film_grain.data));
}
#if DEBUG_FRAME_HDR
- fprintf(stderr, "HDR: post-filmgrain: off=%ld\n",
+ printf("HDR: post-filmgrain: off=%ld\n",
(gb->ptr - init_ptr) * 8 - gb->bits_left);
#endif
@@ -1188,7 +1175,6 @@
}
int dav1d_parse_obus(Dav1dContext *const c, Dav1dData *const in, const int global) {
- static int frame_sidx = 0;
GetBits gb;
int res;
@@ -1241,7 +1227,6 @@
return len + init_byte_pos;
}
- fprintf(stderr, "type=%d\n", type);
switch (type) {
case DAV1D_OBU_SEQ_HDR: {
Dav1dRef *ref = dav1d_ref_create(sizeof(Dav1dSequenceHeader));
@@ -1301,7 +1286,6 @@
memset(c->frame_hdr, 0, sizeof(*c->frame_hdr));
c->frame_hdr->temporal_id = temporal_id;
c->frame_hdr->spatial_id = spatial_id;
- fprintf(stderr, "frame hdr %d %d\n", temporal_id, spatial_id);
if ((res = parse_frame_hdr(c, &gb)) < 0) {
c->frame_hdr = NULL;
return res;
@@ -1380,7 +1364,6 @@
c->n_tiles += 1 + c->tile[c->n_tile_data].end -
c->tile[c->n_tile_data].start;
c->n_tile_data++;
- fprintf(stderr, "tile data %d\n", c->n_tile_data);
break;
}
case DAV1D_OBU_METADATA: {
@@ -1507,7 +1490,6 @@
break;
}
- fprintf(stderr, "seq frame %d %d\n", !!c->seq_hdr, !!c->frame_hdr);
if (c->seq_hdr && c->frame_hdr) {
if (c->frame_hdr->show_existing_frame) {
if (!c->refs[c->frame_hdr->existing_frame_idx].p.p.data[0]) return DAV1D_ERR(EINVAL);
@@ -1562,15 +1544,10 @@
}
c->frame_hdr = NULL;
} else if (c->n_tiles == c->frame_hdr->tiling.cols * c->frame_hdr->tiling.rows) {
- if (!c->n_tile_data) {
- fprintf(stderr, "no tile data?\n");
+ if (!c->n_tile_data)
return DAV1D_ERR(EINVAL);
- }
- fprintf(stderr, "frame submit %d\n", frame_sidx++);
- if ((res = dav1d_submit_frame(c)) < 0) {
- fprintf(stderr, "dav1d_submit_frame failed\n");
+ if ((res = dav1d_submit_frame(c)) < 0)
return res;
- }
assert(!c->n_tile_data);
c->frame_hdr = NULL;
c->n_tiles = 0;
--- a/src/picture.c
+++ b/src/picture.c
@@ -142,7 +142,6 @@
p->p.h = h;
p->seq_hdr = seq_hdr;
p->frame_hdr = frame_hdr;
- fprintf(stderr, "pic frame offset: %d\n", frame_hdr ? frame_hdr->frame_offset : -1);
p->content_light = content_light;
p->mastering_display = mastering_display;
p->itut_t35 = itut_t35;
--- a/src/plan9_thread.c
+++ b/src/plan9_thread.c
@@ -39,13 +39,11 @@
pthread_join(pthread_t *thread, void **res)
{
// FIXME this is wrong ofc
- fprint(2, "joining...\n");
if (thread->waitchan != nil) {
recv(thread->waitchan, res);
chanfree(thread->waitchan);
thread->waitchan = nil;
}
- fprint(2, "joined\n");
return 0;
}
--- a/src/recon_tmpl.c
+++ b/src/recon_tmpl.c
@@ -609,7 +609,6 @@
// sign
const int sign = dav1d_msac_decode_bool_equi(&ts->msac);
- //fprint(2, "# %p %p\n", dq_tbl, qm_tbl);
const unsigned dq = (dq_tbl[1] * qm_tbl[rc] + 16) >> 5;
if (dbg)
printf("Post-sign[%d=%d=%d]: r=%d\n", i, rc, sign, ts->msac.rng);
--- a/src/refmvs.c
+++ b/src/refmvs.c
@@ -185,7 +185,7 @@
const int frac = num * div_mult[den];
const int y = mv.y * frac, x = mv.x * frac;
// Round and clip according to AV1 spec section 7.9.3
- union mv res; // 0x3fff == (1 << 14) - 1
+ union mv res = {0}; // 0x3fff == (1 << 14) - 1
res.y = iclip((y + 8192 + (y >> 31)) >> 14, -0x3fff, 0x3fff);
res.x = iclip((x + 8192 + (x >> 31)) >> 14, -0x3fff, 0x3fff);
return res;
@@ -274,10 +274,9 @@
diff[diff_count[0]++].mv.mv[0] = cand_mv;
}
} else {
- mv i_cand_mv = {{
- .x = -cand_mv.x,
- .y = -cand_mv.y
- }};
+ union mv i_cand_mv = {0};
+ i_cand_mv.x = -cand_mv.x;
+ i_cand_mv.y = -cand_mv.y;
if (diff_count[0] < 2) {
diff[diff_count[0]++].mv.mv[0] =
@@ -368,7 +367,7 @@
gmv[0] = rf->frm_hdr->gmv[ref.ref[0] - 1].type > DAV1D_WM_TYPE_TRANSLATION ?
tgmv[0] : imv;
} else {
- tgmv[0].n = 0;
+ memset(&tgmv[0], 0, sizeof(tgmv[0]));
gmv[0] = imv;
}
if (ref.ref[1] > 0) {
@@ -783,15 +782,17 @@
(abs(cand_b->mv.mv[1].y) | abs(cand_b->mv.mv[1].x)) < 4096)
{
for (int n = 0; n < bw8; n++, x++) {
- rp[x].mv = cand_b->mv.mv[1];
- rp[x].ref = cand_b->ref.ref[1];
+ refmvs_temporal_block b = { .mv = cand_b->mv.mv[1],
+ .ref = cand_b->ref.ref[1] };
+ rp[x] = b;
}
} else if (cand_b->ref.ref[0] > 0 && ref_sign[cand_b->ref.ref[0] - 1] &&
(abs(cand_b->mv.mv[0].y) | abs(cand_b->mv.mv[0].x)) < 4096)
{
for (int n = 0; n < bw8; n++, x++) {
- rp[x].mv = cand_b->mv.mv[0];
- rp[x].ref = cand_b->ref.ref[0];
+ refmvs_temporal_block b = { .mv = cand_b->mv.mv[0],
+ .ref = cand_b->ref.ref[0] };
+ rp[x] = b;
}
} else {
for (int n = 0; n < bw8; n++, x++)
--- a/src/tables.c
+++ b/src/tables.c
@@ -391,12 +391,7 @@
0, 0, 1 << 16,
0, 0, 1 << 16,
},
- {{
- .alpha = 0,
- .beta = 0,
- .gamma = 0,
- .delta = 0,
- }}
+ 0
};
const int8_t dav1d_cdef_directions[2 + 8 + 2 /* dir */][2 /* pass */] = {
--- a/tools/input/ivf.c
+++ b/tools/input/ivf.c
@@ -141,7 +141,6 @@
const ptrdiff_t sz = rl32(data);
if ((res = fread(data, 8, 1, c->f)) != 1)
return -1; // EOF
- fprint(2, "# %zd %zd\n", off, sz);
ptr = dav1d_data_create(buf, sz);
if (!ptr) return -1;
buf->m.offset = off;
@@ -151,7 +150,6 @@
dav1d_data_unref(buf);
return -1;
}
- fprint(2, "@ %zd\n", ftello(c->f));
return 0;
}