Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
deda59a9
Commit
deda59a9
authored
May 19, 2024
by
Nuo Mi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/vvcdec: add RPR dsp
parent
e70225e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
183 additions
and
0 deletions
+183
-0
ctu.h
libavcodec/vvc/ctu.h
+2
-0
dsp.h
libavcodec/vvc/dsp.h
+13
-0
inter_template.c
libavcodec/vvc/inter_template.c
+168
-0
No files found.
libavcodec/vvc/ctu.h
View file @
deda59a9
...
...
@@ -58,6 +58,8 @@
#define BILINEAR_EXTRA_AFTER 1
#define BILINEAR_EXTRA 1
#define SCALED_INT(pos) ((pos) >> 10)
#define MAX_CONTROL_POINTS 3
#define AFFINE_MIN_BLOCK_SIZE 4
...
...
libavcodec/vvc/dsp.h
View file @
deda59a9
...
...
@@ -57,6 +57,19 @@ typedef struct VVCInterDSPContext {
uint8_t
*
dst
,
ptrdiff_t
dst_stride
,
const
uint8_t
*
src
,
ptrdiff_t
src_stride
,
int
height
,
int
denom
,
int
wx
,
int
ox
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
int
width
);
void
(
*
put_scaled
[
2
/* luma, chroma */
][
7
/* log2(width) - 1 */
])(
int16_t
*
dst
,
const
uint8_t
*
src
,
ptrdiff_t
src_stride
,
int
src_height
,
int
x
,
int
y
,
int
dx
,
int
dy
,
int
height
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
int
width
);
void
(
*
put_uni_scaled
[
2
/* luma, chroma */
][
7
/* log2(width) - 1 */
])(
uint8_t
*
dst
,
const
ptrdiff_t
dst_stride
,
const
uint8_t
*
src
,
ptrdiff_t
src_stride
,
int
src_height
,
int
x
,
int
y
,
int
dx
,
int
dy
,
int
height
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
int
width
);
void
(
*
put_uni_w_scaled
[
2
/* luma, chroma */
][
7
/* log2(width) - 1 */
])(
uint8_t
*
dst
,
const
ptrdiff_t
dst_stride
,
const
uint8_t
*
src
,
ptrdiff_t
src_stride
,
int
src_height
,
int
x
,
int
y
,
int
dx
,
int
dy
,
int
height
,
int
denom
,
int
wx
,
int
ox
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
int
width
);
void
(
*
avg
)(
uint8_t
*
dst
,
ptrdiff_t
dst_stride
,
const
int16_t
*
src0
,
const
int16_t
*
src1
,
int
width
,
int
height
);
...
...
libavcodec/vvc/inter_template.c
View file @
deda59a9
...
...
@@ -22,6 +22,165 @@
#include "libavcodec/h26x/h2656_inter_template.c"
#define TMP_STRIDE EDGE_EMU_BUFFER_STRIDE
static
void
av_always_inline
FUNC
(
put_scaled
)(
uint8_t
*
_dst
,
const
ptrdiff_t
_dst_stride
,
const
uint8_t
*
const
_src
,
ptrdiff_t
_src_stride
,
const
int
src_height
,
const
int
_x
,
const
int
_y
,
const
int
dx
,
const
int
dy
,
const
int
height
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
const
int
width
,
const
int
is_uni
,
const
int
is_chroma
)
{
int16_t
tmp_array
[
TMP_STRIDE
*
MAX_PB_SIZE
];
int16_t
*
tmp
=
tmp_array
;
pixel
*
dst
=
(
pixel
*
)
_dst
;
int16_t
*
dst16
=
(
int16_t
*
)
_dst
;
const
ptrdiff_t
dst_stride
=
_dst_stride
/
sizeof
(
pixel
);
const
ptrdiff_t
src_stride
=
_src_stride
/
sizeof
(
pixel
);
const
int
shift
=
FFMAX
(
2
,
14
-
BIT_DEPTH
);
const
int
offset
=
1
<<
(
shift
-
1
);
const
int
taps
=
is_chroma
?
VVC_INTER_CHROMA_TAPS
:
VVC_INTER_LUMA_TAPS
;
const
int
extra
=
is_chroma
?
CHROMA_EXTRA
:
LUMA_EXTRA
;
const
int
extra_before
=
is_chroma
?
CHROMA_EXTRA_BEFORE
:
LUMA_EXTRA_BEFORE
;
const
int
shift1
=
6
-
is_chroma
;
const
int
shift2
=
4
+
is_chroma
;
const
int
x0
=
SCALED_INT
(
_x
);
const
int
y0
=
SCALED_INT
(
_y
);
for
(
int
i
=
0
;
i
<
width
;
i
++
)
{
const
int
tx
=
_x
+
dx
*
i
;
const
int
x
=
SCALED_INT
(
tx
)
-
x0
;
const
int
mx
=
av_mod_uintp2
(
tx
>>
shift1
,
shift2
);
const
int8_t
*
filter
=
hf
+
mx
*
taps
;
const
pixel
*
src
=
(
pixel
*
)
_src
-
extra_before
*
src_stride
;
for
(
int
j
=
0
;
j
<
src_height
+
extra
;
j
++
)
{
tmp
[
j
]
=
(
is_chroma
?
CHROMA_FILTER
(
src
,
1
)
:
LUMA_FILTER
(
src
,
1
))
>>
(
BIT_DEPTH
-
8
);
src
+=
src_stride
;
}
tmp
+=
TMP_STRIDE
;
}
for
(
int
i
=
0
;
i
<
height
;
i
++
)
{
const
int
ty
=
_y
+
dy
*
i
;
const
int
x
=
SCALED_INT
(
ty
)
-
y0
;
const
int
mx
=
av_mod_uintp2
(
ty
>>
shift1
,
shift2
);
const
int8_t
*
filter
=
vf
+
mx
*
taps
;
tmp
=
tmp_array
+
extra_before
;
for
(
int
j
=
0
;
j
<
width
;
j
++
)
{
const
int
val
=
(
is_chroma
?
CHROMA_FILTER
(
tmp
,
1
)
:
LUMA_FILTER
(
tmp
,
1
))
>>
6
;
if
(
is_uni
)
dst
[
j
]
=
av_clip_pixel
((
val
+
offset
)
>>
shift
);
else
dst16
[
j
]
=
val
;
tmp
+=
TMP_STRIDE
;
}
if
(
is_uni
)
dst
+=
dst_stride
;
else
dst16
+=
dst_stride
;
}
}
static
void
FUNC
(
put_luma_scaled
)(
int16_t
*
_dst
,
const
uint8_t
*
_src
,
ptrdiff_t
_src_stride
,
const
int
src_height
,
const
int
x
,
const
int
y
,
const
int
dx
,
const
int
dy
,
const
int
height
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
const
int
width
)
{
FUNC
(
put_scaled
)((
uint8_t
*
)
_dst
,
MAX_PB_SIZE
*
sizeof
(
pixel
),
_src
,
_src_stride
,
src_height
,
x
,
y
,
dx
,
dy
,
height
,
hf
,
vf
,
width
,
0
,
0
);
}
static
void
FUNC
(
put_chroma_scaled
)(
int16_t
*
_dst
,
const
uint8_t
*
_src
,
ptrdiff_t
_src_stride
,
const
int
src_height
,
const
int
x
,
const
int
y
,
const
int
dx
,
const
int
dy
,
const
int
height
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
const
int
width
)
{
FUNC
(
put_scaled
)((
uint8_t
*
)
_dst
,
MAX_PB_SIZE
*
sizeof
(
pixel
),
_src
,
_src_stride
,
src_height
,
x
,
y
,
dx
,
dy
,
height
,
hf
,
vf
,
width
,
0
,
1
);
}
static
void
FUNC
(
put_uni_luma_scaled
)(
uint8_t
*
_dst
,
const
ptrdiff_t
_dst_stride
,
const
uint8_t
*
_src
,
ptrdiff_t
_src_stride
,
const
int
src_height
,
const
int
x
,
const
int
y
,
const
int
dx
,
const
int
dy
,
const
int
height
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
const
int
width
)
{
FUNC
(
put_scaled
)(
_dst
,
_dst_stride
,
_src
,
_src_stride
,
src_height
,
x
,
y
,
dx
,
dy
,
height
,
hf
,
vf
,
width
,
1
,
0
);
}
static
void
FUNC
(
put_uni_chroma_scaled
)(
uint8_t
*
_dst
,
const
ptrdiff_t
_dst_stride
,
const
uint8_t
*
_src
,
ptrdiff_t
_src_stride
,
const
int
src_height
,
const
int
x
,
const
int
y
,
const
int
dx
,
const
int
dy
,
const
int
height
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
const
int
width
)
{
FUNC
(
put_scaled
)(
_dst
,
_dst_stride
,
_src
,
_src_stride
,
src_height
,
x
,
y
,
dx
,
dy
,
height
,
hf
,
vf
,
width
,
1
,
1
);
}
static
void
av_always_inline
FUNC
(
put_uni_w_scaled
)(
uint8_t
*
_dst
,
const
ptrdiff_t
_dst_stride
,
const
uint8_t
*
const
_src
,
ptrdiff_t
_src_stride
,
const
int
src_height
,
const
int
_x
,
const
int
_y
,
const
int
dx
,
const
int
dy
,
const
int
denom
,
const
int
wx
,
const
int
_ox
,
const
int
height
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
const
int
width
,
const
int
is_chroma
)
{
int16_t
tmp_array
[
TMP_STRIDE
*
MAX_PB_SIZE
];
int16_t
*
tmp
=
tmp_array
;
pixel
*
dst
=
(
pixel
*
)
_dst
;
const
ptrdiff_t
dst_stride
=
_dst_stride
/
sizeof
(
pixel
);
const
ptrdiff_t
src_stride
=
_src_stride
/
sizeof
(
pixel
);
const
int
shift
=
FFMAX
(
2
,
14
-
BIT_DEPTH
);
const
int
offset
=
1
<<
(
shift
-
1
);
const
int
ox
=
_ox
*
(
1
<<
(
BIT_DEPTH
-
8
));
const
int
taps
=
is_chroma
?
VVC_INTER_CHROMA_TAPS
:
VVC_INTER_LUMA_TAPS
;
const
int
extra
=
is_chroma
?
CHROMA_EXTRA
:
LUMA_EXTRA
;
const
int
extra_before
=
is_chroma
?
CHROMA_EXTRA_BEFORE
:
LUMA_EXTRA_BEFORE
;
const
int
shift1
=
6
-
is_chroma
;
const
int
shift2
=
4
+
is_chroma
;
const
int
x0
=
SCALED_INT
(
_x
);
const
int
y0
=
SCALED_INT
(
_y
);
for
(
int
i
=
0
;
i
<
width
;
i
++
)
{
const
int
tx
=
_x
+
dx
*
i
;
const
int
x
=
SCALED_INT
(
tx
)
-
x0
;
const
int
mx
=
av_mod_uintp2
(
tx
>>
shift1
,
shift2
);
const
int8_t
*
filter
=
hf
+
mx
*
taps
;
const
pixel
*
src
=
(
pixel
*
)
_src
-
extra_before
*
src_stride
;
for
(
int
j
=
0
;
j
<
src_height
+
extra
;
j
++
)
{
tmp
[
j
]
=
(
is_chroma
?
CHROMA_FILTER
(
src
,
1
)
:
LUMA_FILTER
(
src
,
1
))
>>
(
BIT_DEPTH
-
8
);
src
+=
src_stride
;
}
tmp
+=
TMP_STRIDE
;
}
for
(
int
i
=
0
;
i
<
height
;
i
++
)
{
const
int
ty
=
_y
+
dy
*
i
;
const
int
x
=
SCALED_INT
(
ty
)
-
y0
;
const
int
mx
=
av_mod_uintp2
(
ty
>>
shift1
,
shift2
);
const
int8_t
*
filter
=
vf
+
mx
*
taps
;
tmp
=
tmp_array
+
extra_before
;
for
(
int
j
=
0
;
j
<
width
;
j
++
)
{
const
int
val
=
(
is_chroma
?
CHROMA_FILTER
(
tmp
,
1
)
:
LUMA_FILTER
(
tmp
,
1
))
>>
6
;
dst
[
j
]
=
av_clip_pixel
(((
wx
*
val
+
offset
)
>>
shift
)
+
ox
);
tmp
+=
TMP_STRIDE
;
}
dst
+=
dst_stride
;
}
}
static
void
FUNC
(
put_uni_luma_w_scaled
)(
uint8_t
*
_dst
,
const
ptrdiff_t
_dst_stride
,
const
uint8_t
*
_src
,
ptrdiff_t
_src_stride
,
const
int
src_height
,
const
int
x
,
const
int
y
,
const
int
dx
,
const
int
dy
,
const
int
denom
,
const
int
wx
,
const
int
ox
,
const
int
height
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
const
int
width
)
{
FUNC
(
put_uni_w_scaled
)(
_dst
,
_dst_stride
,
_src
,
_src_stride
,
src_height
,
x
,
y
,
dx
,
dy
,
denom
,
wx
,
ox
,
height
,
hf
,
vf
,
width
,
0
);
}
static
void
FUNC
(
put_uni_chroma_w_scaled
)(
uint8_t
*
_dst
,
const
ptrdiff_t
_dst_stride
,
const
uint8_t
*
_src
,
ptrdiff_t
_src_stride
,
const
int
src_height
,
const
int
x
,
const
int
y
,
const
int
dx
,
const
int
dy
,
const
int
denom
,
const
int
wx
,
const
int
ox
,
const
int
height
,
const
int8_t
*
hf
,
const
int8_t
*
vf
,
const
int
width
)
{
FUNC
(
put_uni_w_scaled
)(
_dst
,
_dst_stride
,
_src
,
_src_stride
,
src_height
,
x
,
y
,
dx
,
dy
,
denom
,
wx
,
ox
,
height
,
hf
,
vf
,
width
,
1
);
}
#undef TMP_STRIDE
static
void
FUNC
(
avg
)(
uint8_t
*
_dst
,
const
ptrdiff_t
_dst_stride
,
const
int16_t
*
src0
,
const
int16_t
*
src1
,
const
int
width
,
const
int
height
)
{
...
...
@@ -440,6 +599,15 @@ static void FUNC(ff_vvc_inter_dsp_init)(VVCInterDSPContext *const inter)
FUNCS
(
LUMA
,
luma
);
FUNCS
(
CHROMA
,
chroma
);
for
(
int
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
inter
->
put_scaled
[
LUMA
]);
i
++
)
{
inter
->
put_scaled
[
LUMA
][
i
]
=
FUNC
(
put_luma_scaled
);
inter
->
put_scaled
[
CHROMA
][
i
]
=
FUNC
(
put_chroma_scaled
);
inter
->
put_uni_scaled
[
LUMA
][
i
]
=
FUNC
(
put_uni_luma_scaled
);
inter
->
put_uni_scaled
[
CHROMA
][
i
]
=
FUNC
(
put_uni_chroma_scaled
);
inter
->
put_uni_w_scaled
[
LUMA
][
i
]
=
FUNC
(
put_uni_luma_w_scaled
);
inter
->
put_uni_w_scaled
[
CHROMA
][
i
]
=
FUNC
(
put_uni_chroma_w_scaled
);
}
inter
->
avg
=
FUNC
(
avg
);
inter
->
w_avg
=
FUNC
(
w_avg
);
...
...
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