Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
e5fb2d4e
Commit
e5fb2d4e
authored
Jul 11, 2016
by
Pascal Massimino
Browse files
remove ROUNDZ_* macros in favor of just ROUND_* ones
Change-Id: I263088be8d71018deb9cc6a9d2c66307770b824d
parent
1178f71d
Changes
4
Hide whitespace changes
Inline
Side-by-side
test/encode_test_driver.cc
View file @
e5fb2d4e
...
...
@@ -188,8 +188,8 @@ static bool compare_img(const vpx_image_t *img1,
const
unsigned
int
w_y
=
img1
->
d_w
;
const
unsigned
int
h_y
=
img1
->
d_h
;
const
unsigned
int
w_uv
=
ROUND
Z
_POWER_OF_TWO
(
w_y
,
img1
->
x_chroma_shift
);
const
unsigned
int
h_uv
=
ROUND
Z
_POWER_OF_TWO
(
h_y
,
img1
->
y_chroma_shift
);
const
unsigned
int
w_uv
=
ROUND_POWER_OF_TWO
(
w_y
,
img1
->
x_chroma_shift
);
const
unsigned
int
h_uv
=
ROUND_POWER_OF_TWO
(
h_y
,
img1
->
y_chroma_shift
);
if
(
img1
->
fmt
!=
img2
->
fmt
||
img1
->
cs
!=
img2
->
cs
...
...
vp10/common/warped_motion.c
View file @
e5fb2d4e
...
...
@@ -85,19 +85,19 @@ static void projectPointsTranslation(int *mat, int *points, int *proj,
for
(
i
=
0
;
i
<
n
;
++
i
)
{
const
int
x
=
*
(
points
++
),
y
=
*
(
points
++
);
if
(
subsampling_x
)
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
((
x
<<
(
WARPEDMODEL_PREC_BITS
+
1
))
+
mat
[
0
]),
WARPEDPIXEL_PREC_BITS
+
1
);
else
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
((
x
<<
WARPEDMODEL_PREC_BITS
))
+
mat
[
0
],
WARPEDPIXEL_PREC_BITS
);
if
(
subsampling_y
)
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
((
y
<<
(
WARPEDMODEL_PREC_BITS
+
1
))
+
mat
[
1
]),
WARPEDPIXEL_PREC_BITS
+
1
);
else
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
((
y
<<
WARPEDMODEL_PREC_BITS
))
+
mat
[
1
],
WARPEDPIXEL_PREC_BITS
);
points
+=
stride_points
-
2
;
...
...
@@ -115,21 +115,21 @@ void projectPointsRotZoom(int *mat, int *points, int *proj,
for
(
i
=
0
;
i
<
n
;
++
i
)
{
const
int
x
=
*
(
points
++
),
y
=
*
(
points
++
);
if
(
subsampling_x
)
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
mat
[
0
]
*
2
*
x
+
mat
[
1
]
*
2
*
y
+
mat
[
2
]
+
(
mat
[
0
]
+
mat
[
1
]
-
(
1
<<
WARPEDMODEL_PREC_BITS
))
/
2
,
WARPEDDIFF_PREC_BITS
+
1
);
else
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
mat
[
0
]
*
x
+
mat
[
1
]
*
y
+
mat
[
2
],
WARPEDDIFF_PREC_BITS
);
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
mat
[
0
]
*
x
+
mat
[
1
]
*
y
+
mat
[
2
],
WARPEDDIFF_PREC_BITS
);
if
(
subsampling_y
)
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
-
mat
[
1
]
*
2
*
x
+
mat
[
0
]
*
2
*
y
+
mat
[
3
]
+
(
-
mat
[
1
]
+
mat
[
0
]
-
(
1
<<
WARPEDMODEL_PREC_BITS
))
/
2
,
WARPEDDIFF_PREC_BITS
+
1
);
else
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
-
mat
[
1
]
*
x
+
mat
[
0
]
*
y
+
mat
[
3
],
WARPEDDIFF_PREC_BITS
);
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
-
mat
[
1
]
*
x
+
mat
[
0
]
*
y
+
mat
[
3
],
WARPEDDIFF_PREC_BITS
);
points
+=
stride_points
-
2
;
proj
+=
stride_proj
-
2
;
}
...
...
@@ -145,21 +145,21 @@ static void projectPointsAffine(int *mat, int *points, int *proj,
for
(
i
=
0
;
i
<
n
;
++
i
)
{
const
int
x
=
*
(
points
++
),
y
=
*
(
points
++
);
if
(
subsampling_x
)
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
mat
[
0
]
*
2
*
x
+
mat
[
1
]
*
2
*
y
+
mat
[
4
]
+
(
mat
[
0
]
+
mat
[
1
]
-
(
1
<<
WARPEDMODEL_PREC_BITS
))
/
2
,
WARPEDDIFF_PREC_BITS
+
1
);
else
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
mat
[
0
]
*
x
+
mat
[
1
]
*
y
+
mat
[
4
],
WARPEDDIFF_PREC_BITS
);
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
mat
[
0
]
*
x
+
mat
[
1
]
*
y
+
mat
[
4
],
WARPEDDIFF_PREC_BITS
);
if
(
subsampling_y
)
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
mat
[
2
]
*
2
*
x
+
mat
[
3
]
*
2
*
y
+
mat
[
5
]
+
(
mat
[
2
]
+
mat
[
3
]
-
(
1
<<
WARPEDMODEL_PREC_BITS
))
/
2
,
WARPEDDIFF_PREC_BITS
+
1
);
else
*
(
proj
++
)
=
ROUND
Z
_POWER_OF_TWO_SIGNED
(
mat
[
2
]
*
x
+
mat
[
3
]
*
y
+
mat
[
5
],
WARPEDDIFF_PREC_BITS
);
*
(
proj
++
)
=
ROUND_POWER_OF_TWO_SIGNED
(
mat
[
2
]
*
x
+
mat
[
3
]
*
y
+
mat
[
5
],
WARPEDDIFF_PREC_BITS
);
points
+=
stride_points
-
2
;
proj
+=
stride_proj
-
2
;
}
...
...
@@ -357,7 +357,7 @@ static int32_t do_cubic_filter(int32_t *p, int x) {
const
int64_t
v2
=
x
*
x
*
(
2
*
p
[
-
1
]
-
5
*
p
[
0
]
+
4
*
p
[
1
]
-
p
[
2
]);
const
int64_t
v3
=
x
*
(
p
[
1
]
-
p
[
-
1
]);
const
int64_t
v4
=
2
*
p
[
0
];
return
(
int32_t
)
ROUND
Z
_POWER_OF_TWO_SIGNED
(
return
(
int32_t
)
ROUND_POWER_OF_TWO_SIGNED
(
(
v4
<<
(
3
*
WARPEDPIXEL_PREC_BITS
))
+
(
v3
<<
(
2
*
WARPEDPIXEL_PREC_BITS
))
+
(
v2
<<
WARPEDPIXEL_PREC_BITS
)
+
v1
,
...
...
vp10/encoder/rdopt.c
View file @
e5fb2d4e
...
...
@@ -1217,7 +1217,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
sse = vpx_sum_squares_2d_i16(diff, diff_stride, bs);
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
sse = ROUND
Z
_POWER_OF_TWO(sse, (xd->bd - 8) * 2);
sse = ROUND_POWER_OF_TWO(sse, (xd->bd - 8) * 2);
#endif // CONFIG_VP9_HIGHBITDEPTH
sse = (int64_t)sse * 16;
...
...
@@ -3027,7 +3027,7 @@ void vp10_tx_block_rd_b(const VP10_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size,
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
tmp = ROUND
Z
_POWER_OF_TWO(tmp, (xd->bd - 8) * 2);
tmp = ROUND_POWER_OF_TWO(tmp, (xd->bd - 8) * 2);
#endif // CONFIG_VP9_HIGHBITDEPTH
*bsse += tmp * 16;
...
...
@@ -6664,7 +6664,7 @@ static int64_t pick_wedge(const VP10_COMP *const cpi,
mask = vp10_get_contiguous_soft_mask(wedge_index, wedge_sign, bsize);
sse = vp10_wedge_sse_from_residuals(r1, d10, mask, N);
sse = ROUND
Z
_POWER_OF_TWO(sse, bd_round);
sse = ROUND_POWER_OF_TWO(sse, bd_round);
model_rd_from_sse(cpi, xd, bsize, 0, sse, &rate, &dist);
rd = RDCOST(x->rdmult, x->rddiv, rate, dist);
...
...
@@ -6726,7 +6726,7 @@ static int64_t pick_wedge_fixed_sign(const VP10_COMP *const cpi,
for (wedge_index = 0; wedge_index < wedge_types; ++wedge_index) {
mask = vp10_get_contiguous_soft_mask(wedge_index, wedge_sign, bsize);
sse = vp10_wedge_sse_from_residuals(r1, d10, mask, N);
sse = ROUND
Z
_POWER_OF_TWO(sse, bd_round);
sse = ROUND_POWER_OF_TWO(sse, bd_round);
model_rd_from_sse(cpi, xd, bsize, 0, sse, &rate, &dist);
rd = RDCOST(x->rdmult, x->rddiv, rate, dist);
...
...
vpx_ports/mem.h
View file @
e5fb2d4e
...
...
@@ -38,24 +38,15 @@
#define __builtin_prefetch(x)
#endif
/* Shift down with rounding for use when n > 0 */
/* Shift down with rounding for use when n >
= 0, value >=
0 */
#define ROUND_POWER_OF_TWO(value, n) \
(((value) + (1 << (
(n) -
1))) >> (n))
(((value) +
((
(1 << (
n)) >>
1))) >> (n))
/* Shift down with rounding for use when n >= 0 */
#define ROUNDZ_POWER_OF_TWO(value, n) \
((n) ? (((value) + (1 << ((n) - 1))) >> (n)) : (value))
/* Shift down with rounding for signed integers, for use when n > 0 */
/* Shift down with rounding for signed integers, for use when n >= 0 */
#define ROUND_POWER_OF_TWO_SIGNED(value, n) \
(((value) < 0) ? -ROUND_POWER_OF_TWO(-(value), (n)) \
: ROUND_POWER_OF_TWO((value), (n)))
/* Shift down with rounding for signed integers, for use when n >= 0 */
#define ROUNDZ_POWER_OF_TWO_SIGNED(value, n) \
(((value) < 0) ? -ROUNDZ_POWER_OF_TWO(-(value), (n)) \
: ROUNDZ_POWER_OF_TWO((value), (n)))
#define ALIGN_POWER_OF_TWO(value, n) \
(((value) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment