Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
ba479f3d
Commit
ba479f3d
authored
Sep 01, 2016
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hevc: Change type of array stride parameters to ptrdiff_t
ptrdiff_t is the correct type for array strides and similar.
parent
e4a94d8b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
34 deletions
+34
-34
hevc.c
libavcodec/hevc.c
+6
-6
hevc_filter.c
libavcodec/hevc_filter.c
+2
-2
hevcdsp_template.c
libavcodec/hevcdsp_template.c
+18
-18
hevc_mc.c
tests/checkasm/hevc_mc.c
+8
-8
No files found.
libavcodec/hevc.c
View file @
ba479f3d
...
...
@@ -1437,11 +1437,11 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size)
HEVCLocalContext
*
lc
=
&
s
->
HEVClc
;
GetBitContext
gb
;
int
cb_size
=
1
<<
log2_cb_size
;
int
stride0
=
s
->
frame
->
linesize
[
0
];
ptrdiff_t
stride0
=
s
->
frame
->
linesize
[
0
];
ptrdiff_t
stride1
=
s
->
frame
->
linesize
[
1
];
ptrdiff_t
stride2
=
s
->
frame
->
linesize
[
2
];
uint8_t
*
dst0
=
&
s
->
frame
->
data
[
0
][
y0
*
stride0
+
(
x0
<<
s
->
ps
.
sps
->
pixel_shift
)];
int
stride1
=
s
->
frame
->
linesize
[
1
];
uint8_t
*
dst1
=
&
s
->
frame
->
data
[
1
][(
y0
>>
s
->
ps
.
sps
->
vshift
[
1
])
*
stride1
+
((
x0
>>
s
->
ps
.
sps
->
hshift
[
1
])
<<
s
->
ps
.
sps
->
pixel_shift
)];
int
stride2
=
s
->
frame
->
linesize
[
2
];
uint8_t
*
dst2
=
&
s
->
frame
->
data
[
2
][(
y0
>>
s
->
ps
.
sps
->
vshift
[
2
])
*
stride2
+
((
x0
>>
s
->
ps
.
sps
->
hshift
[
2
])
<<
s
->
ps
.
sps
->
pixel_shift
)];
int
length
=
cb_size
*
cb_size
*
s
->
ps
.
sps
->
pcm
.
bit_depth
+
((
cb_size
*
cb_size
)
>>
1
)
*
s
->
ps
.
sps
->
pcm
.
bit_depth_chroma
;
...
...
@@ -1520,7 +1520,7 @@ static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride,
if
(
x_off
<
extra_left
||
y_off
<
extra_top
||
x_off
>=
pic_width
-
block_w
-
ff_hevc_qpel_extra_after
[
mx
]
||
y_off
>=
pic_height
-
block_h
-
ff_hevc_qpel_extra_after
[
my
])
{
const
in
t
edge_emu_stride
=
EDGE_EMU_BUFFER_STRIDE
<<
s
->
ps
.
sps
->
pixel_shift
;
const
ptrdiff_
t
edge_emu_stride
=
EDGE_EMU_BUFFER_STRIDE
<<
s
->
ps
.
sps
->
pixel_shift
;
int
offset
=
extra_top
*
srcstride
+
(
extra_left
<<
s
->
ps
.
sps
->
pixel_shift
);
int
buf_offset
=
extra_top
*
edge_emu_stride
+
(
extra_left
<<
s
->
ps
.
sps
->
pixel_shift
);
...
...
@@ -1575,7 +1575,7 @@ static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2,
if
(
x_off
<
EPEL_EXTRA_BEFORE
||
y_off
<
EPEL_EXTRA_AFTER
||
x_off
>=
pic_width
-
block_w
-
EPEL_EXTRA_AFTER
||
y_off
>=
pic_height
-
block_h
-
EPEL_EXTRA_AFTER
)
{
const
in
t
edge_emu_stride
=
EDGE_EMU_BUFFER_STRIDE
<<
s
->
ps
.
sps
->
pixel_shift
;
const
ptrdiff_
t
edge_emu_stride
=
EDGE_EMU_BUFFER_STRIDE
<<
s
->
ps
.
sps
->
pixel_shift
;
int
offset1
=
EPEL_EXTRA_BEFORE
*
(
src1stride
+
(
1
<<
s
->
ps
.
sps
->
pixel_shift
));
int
buf_offset1
=
EPEL_EXTRA_BEFORE
*
(
edge_emu_stride
+
(
1
<<
s
->
ps
.
sps
->
pixel_shift
));
...
...
@@ -1687,7 +1687,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0,
RefPicList
*
refPicList
=
s
->
ref
->
refPicList
;
HEVCFrame
*
ref0
,
*
ref1
;
in
t
tmpstride
=
MAX_PB_SIZE
*
sizeof
(
int16_t
);
ptrdiff_
t
tmpstride
=
MAX_PB_SIZE
*
sizeof
(
int16_t
);
uint8_t
*
dst0
=
POS
(
0
,
x0
,
y0
);
uint8_t
*
dst1
=
POS
(
1
,
x0
,
y0
);
...
...
libavcodec/hevc_filter.c
View file @
ba479f3d
...
...
@@ -172,7 +172,7 @@ static int get_qPy(HEVCContext *s, int xC, int yC)
}
static
void
copy_CTB
(
uint8_t
*
dst
,
uint8_t
*
src
,
int
width
,
int
height
,
in
t
stride
)
int
width
,
int
height
,
ptrdiff_
t
stride
)
{
int
i
;
...
...
@@ -273,7 +273,7 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
int
chroma
=
c_idx
?
1
:
0
;
int
x0
=
x
>>
chroma
;
int
y0
=
y
>>
chroma
;
in
t
stride
=
s
->
frame
->
linesize
[
c_idx
];
ptrdiff_
t
stride
=
s
->
frame
->
linesize
[
c_idx
];
int
ctb_size
=
(
1
<<
(
s
->
ps
.
sps
->
log2_ctb_size
))
>>
s
->
ps
.
sps
->
hshift
[
c_idx
];
int
width
=
FFMIN
(
ctb_size
,
(
s
->
ps
.
sps
->
width
>>
s
->
ps
.
sps
->
hshift
[
c_idx
])
-
x0
);
...
...
libavcodec/hevcdsp_template.c
View file @
ba479f3d
...
...
@@ -396,7 +396,7 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
if
(
sao_eo_class
!=
SAO_EO_VERT
)
{
if
(
borders
[
0
])
{
int
offset_val
=
sao_offset_val
[
0
];
in
t
y_stride
=
0
;
ptrdiff_
t
y_stride
=
0
;
for
(
y
=
0
;
y
<
height
;
y
++
)
{
dst
[
y_stride
]
=
av_clip_pixel
(
src
[
y_stride
]
+
offset_val
);
y_stride
+=
stride
;
...
...
@@ -405,7 +405,7 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
}
if
(
borders
[
2
])
{
int
offset_val
=
sao_offset_val
[
0
];
int
x_stride
=
width
-
1
;
ptrdiff_t
x_stride
=
width
-
1
;
for
(
x
=
0
;
x
<
height
;
x
++
)
{
dst
[
x_stride
]
=
av_clip_pixel
(
src
[
x_stride
]
+
offset_val
);
x_stride
+=
stride
;
...
...
@@ -422,21 +422,21 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
}
if
(
borders
[
3
])
{
int
offset_val
=
sao_offset_val
[
0
];
int
y_stride
=
stride
*
(
height
-
1
);
ptrdiff_t
y_stride
=
stride
*
(
height
-
1
);
for
(
x
=
init_x
;
x
<
width
;
x
++
)
dst
[
x
+
y_stride
]
=
av_clip_pixel
(
src
[
x
+
y_stride
]
+
offset_val
);
height
--
;
}
}
{
in
t
y_stride
=
init_y
*
stride
;
ptrdiff_
t
y_stride
=
init_y
*
stride
;
int
pos_0_0
=
pos
[
sao_eo_class
][
0
][
0
];
int
pos_0_1
=
pos
[
sao_eo_class
][
0
][
1
];
int
pos_1_0
=
pos
[
sao_eo_class
][
1
][
0
];
int
pos_1_1
=
pos
[
sao_eo_class
][
1
][
1
];
in
t
y_stride_0_1
=
(
init_y
+
pos_0_1
)
*
stride
;
in
t
y_stride_1_1
=
(
init_y
+
pos_1_1
)
*
stride
;
ptrdiff_
t
y_stride_0_1
=
(
init_y
+
pos_0_1
)
*
stride
;
ptrdiff_
t
y_stride_1_1
=
(
init_y
+
pos_1_1
)
*
stride
;
for
(
y
=
init_y
;
y
<
height
;
y
++
)
{
for
(
x
=
init_x
;
x
<
width
;
x
++
)
{
int
diff0
=
CMP
(
src
[
x
+
y_stride
],
src
[
x
+
pos_0_0
+
y_stride_0_1
]);
...
...
@@ -503,7 +503,7 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src,
if
(
sao_eo_class
!=
SAO_EO_VERT
)
{
if
(
borders
[
0
])
{
int
offset_val
=
sao_offset_val
[
0
];
int
y_stride
=
0
;
ptrdiff_t
y_stride
=
0
;
for
(
y
=
0
;
y
<
height
;
y
++
)
{
dst
[
y_stride
]
=
av_clip_pixel
(
src
[
y_stride
]
+
offset_val
);
y_stride
+=
stride
;
...
...
@@ -512,7 +512,7 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src,
}
if
(
borders
[
2
])
{
int
offset_val
=
sao_offset_val
[
0
];
int
x_stride
=
width
-
1
;
ptrdiff_t
x_stride
=
width
-
1
;
for
(
x
=
0
;
x
<
height
;
x
++
)
{
dst
[
x_stride
]
=
av_clip_pixel
(
src
[
x_stride
]
+
offset_val
);
x_stride
+=
stride
;
...
...
@@ -521,14 +521,14 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src,
}
}
{
in
t
y_stride
=
init_y
*
stride
;
ptrdiff_
t
y_stride
=
init_y
*
stride
;
int
pos_0_0
=
pos
[
sao_eo_class
][
0
][
0
];
int
pos_0_1
=
pos
[
sao_eo_class
][
0
][
1
];
int
pos_1_0
=
pos
[
sao_eo_class
][
1
][
0
];
int
pos_1_1
=
pos
[
sao_eo_class
][
1
][
1
];
in
t
y_stride_0_1
=
(
init_y
+
pos_0_1
)
*
stride
;
in
t
y_stride_1_1
=
(
init_y
+
pos_1_1
)
*
stride
;
ptrdiff_
t
y_stride_0_1
=
(
init_y
+
pos_0_1
)
*
stride
;
ptrdiff_
t
y_stride_1_1
=
(
init_y
+
pos_1_1
)
*
stride
;
for
(
y
=
init_y
;
y
<
height
;
y
++
)
{
for
(
x
=
init_x
;
x
<
width
;
x
++
)
{
int
diff0
=
CMP
(
src
[
x
+
y_stride
],
src
[
x
+
pos_0_0
+
y_stride_0_1
]);
...
...
@@ -601,21 +601,21 @@ static void FUNC(sao_edge_filter_2)(uint8_t *_dst, uint8_t *_src,
}
if
(
borders
[
3
])
{
int
offset_val
=
sao_offset_val
[
0
];
int
y_stride
=
stride
*
(
height
-
1
);
ptrdiff_t
y_stride
=
stride
*
(
height
-
1
);
for
(
x
=
init_x
;
x
<
width
;
x
++
)
dst
[
x
+
y_stride
]
=
av_clip_pixel
(
src
[
x
+
y_stride
]
+
offset_val
);
height
--
;
}
}
{
in
t
y_stride
=
init_y
*
stride
;
ptrdiff_
t
y_stride
=
init_y
*
stride
;
int
pos_0_0
=
pos
[
sao_eo_class
][
0
][
0
];
int
pos_0_1
=
pos
[
sao_eo_class
][
0
][
1
];
int
pos_1_0
=
pos
[
sao_eo_class
][
1
][
0
];
int
pos_1_1
=
pos
[
sao_eo_class
][
1
][
1
];
in
t
y_stride_0_1
=
(
init_y
+
pos_0_1
)
*
stride
;
in
t
y_stride_1_1
=
(
init_y
+
pos_1_1
)
*
stride
;
ptrdiff_
t
y_stride_0_1
=
(
init_y
+
pos_0_1
)
*
stride
;
ptrdiff_
t
y_stride_1_1
=
(
init_y
+
pos_1_1
)
*
stride
;
for
(
y
=
init_y
;
y
<
height
;
y
++
)
{
for
(
x
=
init_x
;
x
<
width
;
x
++
)
{
int
diff0
=
CMP
(
src
[
x
+
y_stride
],
src
[
x
+
pos_0_0
+
y_stride_0_1
]);
...
...
@@ -681,14 +681,14 @@ static void FUNC(sao_edge_filter_3)(uint8_t *_dst, uint8_t *_src,
init_y
=
init_x
=
0
;
{
in
t
y_stride
=
init_y
*
stride
;
ptrdiff_
t
y_stride
=
init_y
*
stride
;
int
pos_0_0
=
pos
[
sao_eo_class
][
0
][
0
];
int
pos_0_1
=
pos
[
sao_eo_class
][
0
][
1
];
int
pos_1_0
=
pos
[
sao_eo_class
][
1
][
0
];
int
pos_1_1
=
pos
[
sao_eo_class
][
1
][
1
];
in
t
y_stride_0_1
=
(
init_y
+
pos_0_1
)
*
stride
;
in
t
y_stride_1_1
=
(
init_y
+
pos_1_1
)
*
stride
;
ptrdiff_
t
y_stride_0_1
=
(
init_y
+
pos_0_1
)
*
stride
;
ptrdiff_
t
y_stride_1_1
=
(
init_y
+
pos_1_1
)
*
stride
;
for
(
y
=
init_y
;
y
<
height
;
y
++
)
{
for
(
x
=
init_x
;
x
<
width
;
x
++
)
{
...
...
tests/checkasm/hevc_mc.c
View file @
ba479f3d
...
...
@@ -105,8 +105,8 @@ static void check_unweighted_pred(HEVCDSPContext *h, uint8_t *dst0, uint8_t *dst
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
pred_widths
);
i
++
)
{
const
int
width
=
pred_widths
[
i
];
const
in
t
srcstride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
src0
);
const
in
t
dststride
=
FFALIGN
(
width
,
16
)
*
PIXEL_SIZE
(
bit_depth
);
const
ptrdiff_
t
srcstride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
src0
);
const
ptrdiff_
t
dststride
=
FFALIGN
(
width
,
16
)
*
PIXEL_SIZE
(
bit_depth
);
{
declare_func
(
void
,
uint8_t
*
dst
,
ptrdiff_t
dststride
,
int16_t
*
src
,
ptrdiff_t
srcstride
,
int
height
);
...
...
@@ -177,8 +177,8 @@ static void check_weighted_pred(HEVCDSPContext *h, uint8_t *dst0, uint8_t *dst1,
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
pred_widths
);
i
++
)
{
const
int
width
=
pred_widths
[
i
];
const
in
t
srcstride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
src0
);
const
in
t
dststride
=
FFALIGN
(
width
,
16
)
*
PIXEL_SIZE
(
bit_depth
);
const
ptrdiff_
t
srcstride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
src0
);
const
ptrdiff_
t
dststride
=
FFALIGN
(
width
,
16
)
*
PIXEL_SIZE
(
bit_depth
);
{
declare_func
(
void
,
uint8_t
denom
,
int16_t
weight
,
int16_t
offset
,
...
...
@@ -216,8 +216,8 @@ static void check_epel(HEVCDSPContext *h, int16_t *dst0, int16_t *dst1,
for
(
j
=
0
;
j
<
2
;
j
++
)
{
for
(
k
=
0
;
k
<
FF_ARRAY_ELEMS
(
h
->
put_hevc_epel
[
i
][
j
]);
k
++
)
{
int
width
=
pred_widths
[
k
]
/
2
;
in
t
dststride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
dst0
);
in
t
srcstride
=
FFALIGN
(
width
+
3
,
8
)
*
PIXEL_SIZE
(
bit_depth
);
ptrdiff_
t
dststride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
dst0
);
ptrdiff_
t
srcstride
=
FFALIGN
(
width
+
3
,
8
)
*
PIXEL_SIZE
(
bit_depth
);
if
(
!
check_func
(
h
->
put_hevc_epel
[
i
][
j
][
k
],
"epel_%s_%d_%d"
,
interp_names
[
i
][
j
],
width
,
bit_depth
))
continue
;
...
...
@@ -261,8 +261,8 @@ static void check_qpel(HEVCDSPContext *h, int16_t *dst0, int16_t *dst1,
for
(
j
=
0
;
j
<
2
;
j
++
)
{
for
(
k
=
0
;
k
<
FF_ARRAY_ELEMS
(
h
->
put_hevc_qpel
[
i
][
j
]);
k
++
)
{
int
width
=
pred_widths
[
k
];
in
t
dststride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
dst0
);
in
t
srcstride
=
FFALIGN
(
width
+
7
,
8
)
*
PIXEL_SIZE
(
bit_depth
);
ptrdiff_
t
dststride
=
FFALIGN
(
width
,
16
)
*
sizeof
(
*
dst0
);
ptrdiff_
t
srcstride
=
FFALIGN
(
width
+
7
,
8
)
*
PIXEL_SIZE
(
bit_depth
);
if
(
!
check_func
(
h
->
put_hevc_qpel
[
i
][
j
][
k
],
"qpel_%s_%d_%d"
,
interp_names
[
i
][
j
],
width
,
bit_depth
))
continue
;
...
...
Write
Preview
Markdown
is supported
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