Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
dav1d
Commits
35b1cde2
Commit
35b1cde2
authored
Feb 07, 2019
by
Martin Storsjö
Committed by
Ronald S. Bultje
Feb 12, 2019
Browse files
Add casts to silence warnings about intended type conversions/shortenings
parent
4c21c931
Changes
15
Hide whitespace changes
Inline
Side-by-side
src/decode.c
View file @
35b1cde2
...
...
@@ -303,7 +303,7 @@ static void derive_warpmv(const Dav1dTileContext *const t,
if
((
unsigned
)
masks
[
0
]
==
1
&&
!
(
masks
[
1
]
>>
32
))
{
const
int
off
=
t
->
bx
&
(
bs
(
&
r
[
-
b4_stride
])[
0
]
-
1
);
add_sample
(
-
off
,
0
,
1
,
-
1
,
&
r
[
-
b4_stride
]);
}
else
for
(
unsigned
off
=
0
,
xmask
=
masks
[
0
];
np
<
8
&&
xmask
;)
{
// top
}
else
for
(
unsigned
off
=
0
,
xmask
=
(
uint32_t
)
masks
[
0
];
np
<
8
&&
xmask
;)
{
// top
const
int
tz
=
ctz
(
xmask
);
off
+=
tz
;
xmask
>>=
tz
;
...
...
@@ -313,7 +313,7 @@ static void derive_warpmv(const Dav1dTileContext *const t,
if
(
np
<
8
&&
masks
[
1
]
==
1
)
{
const
int
off
=
t
->
by
&
(
bs
(
&
r
[
-
1
])[
1
]
-
1
);
add_sample
(
0
,
-
off
,
-
1
,
1
,
&
r
[
-
1
-
off
*
b4_stride
]);
}
else
for
(
unsigned
off
=
0
,
ymask
=
masks
[
1
];
np
<
8
&&
ymask
;)
{
// left
}
else
for
(
unsigned
off
=
0
,
ymask
=
(
uint32_t
)
masks
[
1
];
np
<
8
&&
ymask
;)
{
// left
const
int
tz
=
ctz
(
ymask
);
off
+=
tz
;
ymask
>>=
tz
;
...
...
@@ -2667,7 +2667,7 @@ int dav1d_decode_frame(Dav1dFrameContext *const f) {
lr_ptr
+=
lr_stride
*
12
;
}
f
->
lf
.
lr_line_sz
=
lr_stride
;
f
->
lf
.
lr_line_sz
=
(
int
)
lr_stride
;
}
// update allocation for loopfilter masks
...
...
src/env.h
View file @
35b1cde2
...
...
@@ -602,8 +602,8 @@ static inline int get_coef_skip_ctx(const TxfmInfo *const t_dim,
}
#undef MERGE_CTX
const
int
max
=
imin
(
la
|
ll
,
4
);
const
int
min
=
imin
(
imin
(
la
,
ll
),
4
);
const
int
max
=
imin
((
int
)
(
la
|
ll
)
,
4
);
const
int
min
=
imin
(
imin
(
(
int
)
la
,
(
int
)
ll
),
4
);
return
skip_contexts
[
min
][
max
];
}
...
...
src/getbits.c
View file @
35b1cde2
...
...
@@ -70,7 +70,7 @@ unsigned dav1d_get_bits(GetBits *const c, const unsigned n) {
c
->
bits_left
-=
n
;
c
->
state
<<=
n
;
return
state
>>
(
64
-
n
);
return
(
unsigned
)
(
state
>>
(
64
-
n
)
)
;
}
int
dav1d_get_sbits
(
GetBits
*
const
c
,
const
unsigned
n
)
{
...
...
src/getbits.h
View file @
35b1cde2
...
...
@@ -52,7 +52,7 @@ void dav1d_bytealign_get_bits(GetBits *c);
// Return the current bit position relative to the start of the buffer.
static
inline
unsigned
dav1d_get_bits_pos
(
const
GetBits
*
c
)
{
return
(
c
->
ptr
-
c
->
ptr_start
)
*
8
-
c
->
bits_left
;
return
(
unsigned
)
(
c
->
ptr
-
c
->
ptr_start
)
*
8
-
c
->
bits_left
;
}
#endif
/* __DAV1D_SRC_GETBITS_H__ */
src/ipred_tmpl.c
View file @
35b1cde2
...
...
@@ -719,7 +719,7 @@ static void pal_pred_c(pixel *dst, const ptrdiff_t stride,
{
for
(
int
y
=
0
;
y
<
h
;
y
++
)
{
for
(
int
x
=
0
;
x
<
w
;
x
++
)
dst
[
x
]
=
pal
[
idx
[
x
]];
dst
[
x
]
=
(
pixel
)
pal
[
idx
[
x
]];
idx
+=
w
;
dst
+=
PXSTRIDE
(
stride
);
}
...
...
src/lf_mask.c
View file @
35b1cde2
...
...
@@ -177,7 +177,7 @@ static inline void mask_edges_intra(uint16_t (*const masks)[32][3][2],
// inner (tx) left|right edges
const
int
hstep
=
t_dim
->
w
;
unsigned
t
=
1U
<<
by4
;
unsigned
inner
=
(((
uint64_t
)
t
)
<<
h4
)
-
t
;
unsigned
inner
=
(
unsigned
)
(
(((
uint64_t
)
t
)
<<
h4
)
-
t
)
;
unsigned
inner1
=
inner
&
0xffff
,
inner2
=
inner
>>
16
;
for
(
x
=
hstep
;
x
<
w4
;
x
+=
hstep
)
{
if
(
inner1
)
masks
[
0
][
bx4
+
x
][
twl4c
][
0
]
|=
inner1
;
...
...
@@ -189,7 +189,7 @@ static inline void mask_edges_intra(uint16_t (*const masks)[32][3][2],
// bottom
const
int
vstep
=
t_dim
->
h
;
t
=
1U
<<
bx4
;
inner
=
(((
uint64_t
)
t
)
<<
w4
)
-
t
;
inner
=
(
unsigned
)
(
(((
uint64_t
)
t
)
<<
w4
)
-
t
)
;
inner1
=
inner
&
0xffff
;
inner2
=
inner
>>
16
;
for
(
y
=
vstep
;
y
<
h4
;
y
+=
vstep
)
{
...
...
@@ -248,7 +248,7 @@ static inline void mask_edges_chroma(uint16_t (*const masks)[32][2][2],
// inner (tx) left|right edges
const
int
hstep
=
t_dim
->
w
;
unsigned
t
=
1U
<<
cby4
;
unsigned
inner
=
(((
uint64_t
)
t
)
<<
ch4
)
-
t
;
unsigned
inner
=
(
unsigned
)
(
(((
uint64_t
)
t
)
<<
ch4
)
-
t
)
;
unsigned
inner1
=
inner
&
((
1
<<
vmask
)
-
1
),
inner2
=
inner
>>
vmask
;
for
(
x
=
hstep
;
x
<
cw4
;
x
+=
hstep
)
{
if
(
inner1
)
masks
[
0
][
cbx4
+
x
][
twl4c
][
0
]
|=
inner1
;
...
...
@@ -260,7 +260,7 @@ static inline void mask_edges_chroma(uint16_t (*const masks)[32][2][2],
// bottom
const
int
vstep
=
t_dim
->
h
;
t
=
1U
<<
cbx4
;
inner
=
(((
uint64_t
)
t
)
<<
cw4
)
-
t
;
inner
=
(
unsigned
)
(
(((
uint64_t
)
t
)
<<
cw4
)
-
t
)
;
inner1
=
inner
&
((
1
<<
hmask
)
-
1
),
inner2
=
inner
>>
hmask
;
for
(
y
=
vstep
;
y
<
ch4
;
y
+=
vstep
)
{
if
(
inner1
)
masks
[
1
][
cby4
+
y
][
thl4c
][
0
]
|=
inner1
;
...
...
src/mc_tmpl.c
View file @
35b1cde2
...
...
@@ -829,20 +829,21 @@ static void emu_edge_c(const intptr_t bw, const intptr_t bh,
const
pixel
*
ref
,
const
ptrdiff_t
ref_stride
)
{
// find offset in reference of visible block to copy
ref
+=
iclip
(
y
,
0
,
ih
-
1
)
*
PXSTRIDE
(
ref_stride
)
+
iclip
(
x
,
0
,
iw
-
1
);
ref
+=
iclip
((
int
)
y
,
0
,
(
int
)
ih
-
1
)
*
PXSTRIDE
(
ref_stride
)
+
iclip
((
int
)
x
,
0
,
(
int
)
iw
-
1
);
// number of pixels to extend (left, right, top, bottom)
const
int
left_ext
=
iclip
(
-
x
,
0
,
bw
-
1
);
const
int
right_ext
=
iclip
(
x
+
bw
-
iw
,
0
,
bw
-
1
);
const
int
left_ext
=
iclip
(
(
int
)
-
x
,
0
,
(
int
)
bw
-
1
);
const
int
right_ext
=
iclip
((
int
)
(
x
+
bw
-
iw
)
,
0
,
(
int
)
bw
-
1
);
assert
(
left_ext
+
right_ext
<
bw
);
const
int
top_ext
=
iclip
(
-
y
,
0
,
bh
-
1
);
const
int
bottom_ext
=
iclip
(
y
+
bh
-
ih
,
0
,
bh
-
1
);
const
int
top_ext
=
iclip
(
(
int
)
-
y
,
0
,
(
int
)
bh
-
1
);
const
int
bottom_ext
=
iclip
((
int
)
(
y
+
bh
-
ih
)
,
0
,
(
int
)
bh
-
1
);
assert
(
top_ext
+
bottom_ext
<
bh
);
// copy visible portion first
pixel
*
blk
=
dst
+
top_ext
*
PXSTRIDE
(
dst_stride
);
const
int
center_w
=
bw
-
left_ext
-
right_ext
;
const
int
center_h
=
bh
-
top_ext
-
bottom_ext
;
const
int
center_w
=
(
int
)
(
bw
-
left_ext
-
right_ext
)
;
const
int
center_h
=
(
int
)
(
bh
-
top_ext
-
bottom_ext
)
;
for
(
int
y
=
0
;
y
<
center_h
;
y
++
)
{
pixel_copy
(
blk
+
left_ext
,
ref
,
center_w
);
// extend left edge for this line
...
...
src/msac.c
View file @
35b1cde2
...
...
@@ -88,7 +88,7 @@ unsigned msac_decode_symbol(MsacContext *const s, const uint16_t *const cdf,
assert
(
u
<=
s
->
rng
);
ctx_norm
(
s
,
s
->
dif
-
(
v
<<
(
EC_WIN_SIZE
-
16
)),
u
-
v
);
ctx_norm
(
s
,
s
->
dif
-
(
v
<<
(
EC_WIN_SIZE
-
16
)),
(
unsigned
)
(
u
-
v
)
)
;
return
ret
-
1
;
}
...
...
@@ -104,7 +104,7 @@ unsigned msac_decode_bool_equi(MsacContext *const s) {
ret
=
dif
>=
vw
;
dif
-=
ret
*
vw
;
v
+=
ret
*
(
r
-
2
*
v
);
ctx_norm
(
s
,
dif
,
v
);
ctx_norm
(
s
,
dif
,
(
unsigned
)
v
);
return
!
ret
;
}
...
...
@@ -121,7 +121,7 @@ unsigned msac_decode_bool(MsacContext *const s, const unsigned f) {
ret
=
dif
>=
vw
;
dif
-=
ret
*
vw
;
v
+=
ret
*
(
r
-
2
*
v
);
ctx_norm
(
s
,
dif
,
v
);
ctx_norm
(
s
,
dif
,
(
unsigned
)
v
);
return
!
ret
;
}
...
...
src/obu.c
View file @
35b1cde2
...
...
@@ -1198,7 +1198,7 @@ int dav1d_parse_obus(Dav1dContext *const c, Dav1dData *const in, int global) {
if
(
more
&&
++
i
==
8
)
goto
error
;
}
while
(
more
);
else
len
=
in
->
sz
-
1
-
has_extension
;
len
=
(
int
)
in
->
sz
-
1
-
has_extension
;
if
(
gb
.
error
)
goto
error
;
const
unsigned
init_bit_pos
=
dav1d_get_bits_pos
(
&
gb
);
...
...
src/recon_tmpl.c
View file @
35b1cde2
...
...
@@ -200,7 +200,8 @@ static int decode_coefs(Dav1dTileContext *const t,
}
while
(
tok
<
15
);
}
levels
[
x
*
stride
+
y
]
=
cf
[
rc
]
=
tok
;
cf
[
rc
]
=
tok
;
levels
[
x
*
stride
+
y
]
=
(
uint8_t
)
cf
[
rc
];
}
// residual and sign
...
...
@@ -559,7 +560,7 @@ static int mc(Dav1dTileContext *const t,
int
orig_pos_x
=
(
bx
*
h_mul
<<
4
)
+
mvx
*
(
1
<<
!
ss_hor
);
#define scale_mv(res, val, scale) do { \
const int64_t tmp = (int64_t)(val) * scale + (scale - 0x4000) * 8; \
res =
(int)
apply_sign64((llabs(tmp) + 128) >> 8, tmp) + 32; \
res = apply_sign64
((int)
((llabs(tmp) + 128) >> 8
)
, tmp) + 32;
\
} while (0)
int
pos_y
,
pos_x
;
scale_mv
(
pos_x
,
orig_pos_x
,
f
->
svc
[
refidx
][
0
].
scale
);
...
...
src/ref_mvs.c
View file @
35b1cde2
...
...
@@ -1916,7 +1916,7 @@ void av1_find_ref_mvs(CANDIDATE_MV *mvstack, int *cnt, int_mv (*mvlist)[2],
{
const
int
bw4
=
dav1d_block_dimensions
[
bs
][
0
];
const
int
bh4
=
dav1d_block_dimensions
[
bs
][
1
];
int
stride
=
cm
->
cur_frame
.
mv_stride
;
int
stride
=
(
int
)
cm
->
cur_frame
.
mv_stride
;
MACROBLOCKD
xd
=
(
MACROBLOCKD
)
{
.
n8_w
=
bw4
,
.
n8_h
=
bh4
,
...
...
@@ -2018,7 +2018,7 @@ int av1_init_ref_mv_common(AV1_COMMON *cm,
cm
->
frame_refs
[
i
].
idx
=
i
;
cm
->
mi_cols
=
w8
<<
1
;
cm
->
mi_rows
=
h8
<<
1
;
cm
->
mi_stride
=
stride
;
cm
->
mi_stride
=
(
int
)
stride
;
for
(
int
i
=
0
;
i
<
7
;
i
++
)
{
cm
->
buffer_pool
.
frame_bufs
[
i
].
mi_rows
=
cm
->
mi_rows
;
cm
->
buffer_pool
.
frame_bufs
[
i
].
mi_cols
=
cm
->
mi_cols
;
...
...
src/thread_task.c
View file @
35b1cde2
...
...
@@ -59,7 +59,7 @@ void *dav1d_tile_task(void *const data) {
Dav1dTileContext
*
const
t
=
data
;
struct
FrameTileThreadData
*
const
fttd
=
t
->
tile_thread
.
fttd
;
const
Dav1dFrameContext
*
const
f
=
t
->
f
;
const
int
tile_thread_idx
=
t
-
f
->
tc
;
const
int
tile_thread_idx
=
(
int
)
(
t
-
f
->
tc
)
;
const
uint64_t
mask
=
1ULL
<<
tile_thread_idx
;
for
(;;)
{
...
...
src/warpmv.c
View file @
35b1cde2
...
...
@@ -90,10 +90,10 @@ int dav1d_get_shear_params(Dav1dWarpedMotionParams *const wm) {
const
int
y
=
apply_sign
(
resolve_divisor_32
(
abs
(
mat
[
2
]),
&
shift
),
mat
[
2
]);
const
int64_t
v1
=
((
int64_t
)
mat
[
4
]
*
0x10000
)
*
y
;
const
int
rnd
=
(
1
<<
shift
)
>>
1
;
wm
->
gamma
=
iclip_wmp
(
apply_sign64
((
llabs
(
v1
)
+
rnd
)
>>
shift
,
v1
));
wm
->
gamma
=
iclip_wmp
(
apply_sign64
((
int
)
((
llabs
(
v1
)
+
rnd
)
>>
shift
)
,
v1
));
const
int64_t
v2
=
((
int64_t
)
mat
[
3
]
*
mat
[
4
])
*
y
;
wm
->
delta
=
iclip_wmp
(
mat
[
5
]
-
(
int
)
apply_sign64
((
llabs
(
v2
)
+
rnd
)
>>
shift
,
v2
)
-
apply_sign64
((
int
)
((
llabs
(
v2
)
+
rnd
)
>>
shift
)
,
v2
)
-
0x10000
);
return
(
4
*
abs
(
wm
->
alpha
)
+
7
*
abs
(
wm
->
beta
)
>=
0x10000
)
||
...
...
@@ -115,7 +115,9 @@ static int get_mult_shift_ndiag(const int64_t px,
const
int
idet
,
const
int
shift
)
{
const
int64_t
v1
=
px
*
idet
;
const
int
v2
=
apply_sign64
((
llabs
(
v1
)
+
((
1LL
<<
shift
)
>>
1
))
>>
shift
,
v1
);
const
int
v2
=
apply_sign64
((
int
)
((
llabs
(
v1
)
+
((
1LL
<<
shift
)
>>
1
))
>>
shift
),
v1
);
return
iclip
(
v2
,
-
0x1fff
,
0x1fff
);
}
...
...
@@ -123,7 +125,9 @@ static int get_mult_shift_diag(const int64_t px,
const
int
idet
,
const
int
shift
)
{
const
int64_t
v1
=
px
*
idet
;
const
int
v2
=
apply_sign64
((
llabs
(
v1
)
+
((
1LL
<<
shift
)
>>
1
))
>>
shift
,
v1
);
const
int
v2
=
apply_sign64
((
int
)
((
llabs
(
v1
)
+
((
1LL
<<
shift
)
>>
1
))
>>
shift
),
v1
);
return
iclip
(
v2
,
0xe001
,
0x11fff
);
}
...
...
tests/checkasm/checkasm.c
View file @
35b1cde2
...
...
@@ -53,7 +53,7 @@ static unsigned get_seed(void) {
static
unsigned
get_seed
(
void
)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
return
tv
.
tv_usec
+
tv
.
tv_sec
*
1000000
;
return
(
unsigned
)
(
tv
.
tv_usec
+
tv
.
tv_sec
*
1000000
)
;
}
#endif
...
...
@@ -325,7 +325,7 @@ static int measure_nop_time(void) {
for
(
i
=
0
;
i
<
10000
;
i
++
)
{
uint64_t
t
=
readtime
();
nops
[
i
]
=
readtime
()
-
t
;
nops
[
i
]
=
(
uint16_t
)
(
readtime
()
-
t
)
;
}
qsort
(
nops
,
10000
,
sizeof
(
uint16_t
),
cmp_nop
);
...
...
@@ -345,8 +345,8 @@ static void print_benchs(const CheckasmFunc *const f) {
const
CheckasmFuncVersion
*
v
=
&
f
->
versions
;
do
{
if
(
v
->
iterations
)
{
int
decicycles
=
(
10
*
v
->
cycles
/
v
->
iterations
-
state
.
nop_time
)
/
4
;
int
decicycles
=
(
int
)
(
10
*
v
->
cycles
/
v
->
iterations
-
state
.
nop_time
)
/
4
;
printf
(
"%s_%s: %d.%d
\n
"
,
f
->
name
,
cpu_suffix
(
v
->
cpu
),
decicycles
/
10
,
decicycles
%
10
);
}
...
...
tests/checkasm/itx.c
View file @
35b1cde2
...
...
@@ -215,7 +215,7 @@ static int ftx(coef *const buf, const enum RectTxfmSize tx,
for
(
int
y
=
0
;
y
<
sh
;
y
++
)
for
(
int
x
=
0
;
x
<
sw
;
x
++
)
buf
[
y
*
sw
+
x
]
=
out
[
y
*
w
+
x
]
+
0
.
5
;
buf
[
y
*
sw
+
x
]
=
(
coef
)
(
out
[
y
*
w
+
x
]
+
0
.
5
)
;
return
copy_subcoefs
(
buf
,
tx
,
txtp
,
sw
,
sh
,
subsh
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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