diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-07-27 09:19:16 +0000 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-07-28 08:04:19 +0000 |
commit | 53a11135f2fb2123408b295f9aaae3d6f861aea5 (patch) | |
tree | 25e79efcbe70a13f07265c2750df7690b51540a5 | |
parent | e36a2f4c5280e2779b0e88974295a711cf8d88be (diff) | |
download | ffmpeg-53a11135f2fb2123408b295f9aaae3d6f861aea5.tar.gz |
hevc: simplify splitting the transform tree blocks
-rw-r--r-- | libavcodec/hevc.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 18c7920764..9c5cc50f0c 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -1392,29 +1392,24 @@ static int hls_transform_tree(HEVCContext *s, int x0, int y0, } if (split_transform_flag) { - int x1 = x0 + ((1 << log2_trafo_size) >> 1); - int y1 = y0 + ((1 << log2_trafo_size) >> 1); + const int trafo_size_split = 1 << (log2_trafo_size - 1); + const int x1 = x0 + trafo_size_split; + const int y1 = y0 + trafo_size_split; + +#define SUBDIVIDE(x, y, idx) \ +do { \ + ret = hls_transform_tree(s, x, y, x0, y0, cb_xBase, cb_yBase, log2_cb_size, \ + log2_trafo_size - 1, trafo_depth + 1, idx); \ + if (ret < 0) \ + return ret; \ +} while (0) - ret = hls_transform_tree(s, x0, y0, x0, y0, cb_xBase, cb_yBase, - log2_cb_size, log2_trafo_size - 1, - trafo_depth + 1, 0); - if (ret < 0) - return ret; - ret = hls_transform_tree(s, x1, y0, x0, y0, cb_xBase, cb_yBase, - log2_cb_size, log2_trafo_size - 1, - trafo_depth + 1, 1); - if (ret < 0) - return ret; - ret = hls_transform_tree(s, x0, y1, x0, y0, cb_xBase, cb_yBase, - log2_cb_size, log2_trafo_size - 1, - trafo_depth + 1, 2); - if (ret < 0) - return ret; - ret = hls_transform_tree(s, x1, y1, x0, y0, cb_xBase, cb_yBase, - log2_cb_size, log2_trafo_size - 1, - trafo_depth + 1, 3); - if (ret < 0) - return ret; + SUBDIVIDE(x0, y0, 0); + SUBDIVIDE(x1, y0, 1); + SUBDIVIDE(x0, y1, 2); + SUBDIVIDE(x1, y1, 3); + +#undef SUBDIVIDE } else { int min_tu_size = 1 << s->sps->log2_min_tb_size; int log2_min_tu_size = s->sps->log2_min_tb_size; |