diff options
author | Deb Mukherjee <debargha@google.com> | 2012-10-09 13:19:15 -0700 |
---|---|---|
committer | Deb Mukherjee <debargha@google.com> | 2012-11-10 07:12:30 -0800 |
commit | d01357bbad6fb495f16c763add16dcc351a6f8b3 (patch) | |
tree | 2713ae531f9110d60255a97bbdb82a1a86a8cdad /vp9/common/reconintra.c | |
parent | 3f7182cb0d880109a79b4ea86bb7563254642307 (diff) | |
download | libvpx-d01357bbad6fb495f16c763add16dcc351a6f8b3.tar libvpx-d01357bbad6fb495f16c763add16dcc351a6f8b3.tar.gz libvpx-d01357bbad6fb495f16c763add16dcc351a6f8b3.tar.bz2 libvpx-d01357bbad6fb495f16c763add16dcc351a6f8b3.zip |
New b-intra mode where direction is contextual
Preliminary patch on a new 4x4 intra mode B_CONTEXT_PRED where the
dominant direction from the context is used to encode. Various decoder
changes are needed to support decoding of B_CONTEXT_PRED in conjunction
with hybrid transforms since the scan order and tokenization depends on
the actual direction of prediction obtained from the context. Currently
the traditional directional modes are used in conjunction with the
B_CONTEXT_PRED, which also seems to provide the best results.
The gains are small - in the 0.1% range.
Change-Id: I5a7ea80b5218f42a9c0dfb42d3f79a68c7f0cdc2
Diffstat (limited to 'vp9/common/reconintra.c')
-rw-r--r-- | vp9/common/reconintra.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/vp9/common/reconintra.c b/vp9/common/reconintra.c index 97f782c52..c9b8bd052 100644 --- a/vp9/common/reconintra.c +++ b/vp9/common/reconintra.c @@ -196,9 +196,50 @@ static void d153_predictor(uint8_t *ypred_ptr, int y_stride, int n, } } +static void corner_predictor(unsigned char *ypred_ptr, int y_stride, int n, + unsigned char *yabove_row, + unsigned char *yleft_col) { + int h[32], v[32], mh, mv, maxgradh, maxgradv, x, y, nx, ny; + int i, j; + int top_left = yabove_row[-1]; + mh = mv = 0; + maxgradh = yabove_row[1] - top_left; + maxgradv = yleft_col[1] - top_left; + for (i = 2; i < n; ++i) { + int gh = yabove_row[i] - yabove_row[i - 2]; + int gv = yleft_col[i] - yleft_col[i - 2]; + if (gh > maxgradh) { + maxgradh = gh; + mh = i - 1; + } + if (gv > maxgradv) { + maxgradv = gv; + mv = i - 1; + } + } + nx = mh + mv + 3; + ny = 2 * n + 1 - nx; + + x = top_left; + for (i = 0; i <= mh; ++i) x += yabove_row[i]; + for (i = 0; i <= mv; ++i) x += yleft_col[i]; + x += (nx >> 1); + x /= nx; + y = 0; + for (i = mh + 1; i < n; ++i) y += yabove_row[i]; + for (i = mv + 1; i < n; ++i) y += yleft_col[i]; + y += (ny >> 1); + y /= ny; + + for (i = 0; i < n; ++i) { + for (j = 0; j < n; ++j) + ypred_ptr[j] = (i <= mh && j <= mv ? x : y); + ypred_ptr += y_stride; + } +} + void vp9_recon_intra_mbuv(MACROBLOCKD *xd) { int i; - for (i = 16; i < 24; i += 2) { BLOCKD *b = &xd->block[i]; vp9_recon2b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride); |