aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/hevc_mvs.c
diff options
context:
space:
mode:
authorgcocherel <gildas.cocherel@laposte.net>2014-06-24 08:27:16 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-24 13:11:40 +0200
commitba70563d5549fdbde4c254c9334a123c439ccc30 (patch)
treea6a6d7aa2bf3760f01e2d2560b597d1e459c0785 /libavcodec/hevc_mvs.c
parentf7f1f4c7ce9ce689823e13a53b694eb14cbbf6e7 (diff)
downloadffmpeg-ba70563d5549fdbde4c254c9334a123c439ccc30.tar.gz
hevc/pps: optimized size of min_tb_addr_zs
reduce computation too (cherry picked from commit 39c4d45c7788081c45c7fae51b7c5d0bcbaece9d) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/hevc_mvs.c')
-rw-r--r--libavcodec/hevc_mvs.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c
index b7ca79c35e..2b017dd20f 100644
--- a/libavcodec/hevc_mvs.c
+++ b/libavcodec/hevc_mvs.c
@@ -65,20 +65,27 @@ static int z_scan_block_avail(HEVCContext *s, int xCurr, int yCurr,
int xN, int yN)
{
#define MIN_TB_ADDR_ZS(x, y) \
- s->pps->min_tb_addr_zs[(y) * s->sps->min_tb_width + (x)]
- int Curr = MIN_TB_ADDR_ZS(xCurr >> s->sps->log2_min_tb_size,
- yCurr >> s->sps->log2_min_tb_size);
- int N;
+ s->pps->min_tb_addr_zs[(y) * (s->sps->tb_mask+2) + (x)]
+
+ int xCurr_ctb = xCurr >> s->sps->log2_ctb_size;
+ int yCurr_ctb = yCurr >> s->sps->log2_ctb_size;
+ int xN_ctb = xN >> s->sps->log2_ctb_size;
+ int yN_ctb = yN >> s->sps->log2_ctb_size;
if (xN < 0 || yN < 0 ||
xN >= s->sps->width ||
yN >= s->sps->height)
return 0;
- N = MIN_TB_ADDR_ZS(xN >> s->sps->log2_min_tb_size,
- yN >> s->sps->log2_min_tb_size);
-
- return N <= Curr;
+ if( yN_ctb < yCurr_ctb || xN_ctb < xCurr_ctb )
+ return 1;
+ else {
+ int Curr = MIN_TB_ADDR_ZS((xCurr >> s->sps->log2_min_tb_size) & s->sps->tb_mask,
+ (yCurr >> s->sps->log2_min_tb_size) & s->sps->tb_mask);
+ int N = MIN_TB_ADDR_ZS((xN >> s->sps->log2_min_tb_size) & s->sps->tb_mask,
+ (yN >> s->sps->log2_min_tb_size) & s->sps->tb_mask);
+ return N <= Curr;
+ }
}
static int same_prediction_block(HEVCLocalContext *lc, int log2_cb_size,