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
69f34e5b
Commit
69f34e5b
authored
Jul 09, 2006
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify
Originally committed as revision 5694 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
e148c6e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
80 deletions
+58
-80
cavs.c
libavcodec/cavs.c
+25
-69
cavsdata.h
libavcodec/cavsdata.h
+33
-11
No files found.
libavcodec/cavs.c
View file @
69f34e5b
...
@@ -104,26 +104,18 @@ typedef struct {
...
@@ -104,26 +104,18 @@ typedef struct {
*
*
****************************************************************************/
****************************************************************************/
static
inline
int
get_bs
_p
(
vector_t
*
mvP
,
vector_t
*
mvQ
)
{
static
inline
int
get_bs
(
vector_t
*
mvP
,
vector_t
*
mvQ
,
int
b
)
{
if
((
mvP
->
ref
==
REF_INTRA
)
||
(
mvQ
->
ref
==
REF_INTRA
))
if
((
mvP
->
ref
==
REF_INTRA
)
||
(
mvQ
->
ref
==
REF_INTRA
))
return
2
;
return
2
;
if
(
mvP
->
ref
!=
mvQ
->
ref
)
return
1
;
if
(
(
abs
(
mvP
->
x
-
mvQ
->
x
)
>=
4
)
||
(
abs
(
mvP
->
y
-
mvQ
->
y
)
>=
4
)
)
if
(
(
abs
(
mvP
->
x
-
mvQ
->
x
)
>=
4
)
||
(
abs
(
mvP
->
y
-
mvQ
->
y
)
>=
4
)
)
return
1
;
return
1
;
return
0
;
if
(
b
){
}
mvP
+=
MV_BWD_OFFS
;
mvQ
+=
MV_BWD_OFFS
;
static
inline
int
get_bs_b
(
vector_t
*
mvP
,
vector_t
*
mvQ
)
{
if
(
(
abs
(
mvP
->
x
-
mvQ
->
x
)
>=
4
)
||
(
abs
(
mvP
->
y
-
mvQ
->
y
)
>=
4
)
)
if
((
mvP
->
ref
==
REF_INTRA
)
||
(
mvQ
->
ref
==
REF_INTRA
))
{
return
1
;
return
2
;
}
else
{
}
else
{
if
(
mvP
->
ref
!=
mvQ
->
ref
)
vector_t
*
mvPbw
=
mvP
+
MV_BWD_OFFS
;
vector_t
*
mvQbw
=
mvQ
+
MV_BWD_OFFS
;
if
(
(
abs
(
mvP
->
x
-
mvQ
->
x
)
>=
4
)
||
(
abs
(
mvP
->
y
-
mvQ
->
y
)
>=
4
)
||
(
abs
(
mvPbw
->
x
-
mvQbw
->
x
)
>=
4
)
||
(
abs
(
mvPbw
->
y
-
mvQbw
->
y
)
>=
4
)
)
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -165,52 +157,23 @@ static void filter_mb(AVSContext *h, enum mb_t mb_type) {
...
@@ -165,52 +157,23 @@ static void filter_mb(AVSContext *h, enum mb_t mb_type) {
h
->
left_border_v
[
i
+
1
]
=
*
(
h
->
cv
+
7
+
i
*
h
->
c_stride
);
h
->
left_border_v
[
i
+
1
]
=
*
(
h
->
cv
+
7
+
i
*
h
->
c_stride
);
}
}
if
(
!
h
->
loop_filter_disable
)
{
if
(
!
h
->
loop_filter_disable
)
{
/* clear bs */
*
((
uint64_t
*
)
bs
)
=
0
;
/* determine bs */
/* determine bs */
switch
(
mb_type
)
{
if
(
mb_type
==
I_8X8
)
case
I_8X8
:
*
((
uint64_t
*
)
bs
)
=
0x0202020202020202ULL
;
*
((
uint64_t
*
)
bs
)
=
0x0202020202020202ULL
;
break
;
else
{
case
P_8X8
:
*
((
uint64_t
*
)
bs
)
=
0
;
case
P_8X16
:
if
(
partition_flags
[
mb_type
]
&
SPLITV
){
bs
[
2
]
=
get_bs_p
(
&
h
->
mv
[
MV_FWD_X0
],
&
h
->
mv
[
MV_FWD_X1
]);
bs
[
2
]
=
get_bs
(
&
h
->
mv
[
MV_FWD_X0
],
&
h
->
mv
[
MV_FWD_X1
],
mb_type
>
P_8X8
);
bs
[
3
]
=
get_bs_p
(
&
h
->
mv
[
MV_FWD_X2
],
&
h
->
mv
[
MV_FWD_X3
]);
bs
[
3
]
=
get_bs
(
&
h
->
mv
[
MV_FWD_X2
],
&
h
->
mv
[
MV_FWD_X3
],
mb_type
>
P_8X8
);
case
P_16X8
:
bs
[
6
]
=
get_bs_p
(
&
h
->
mv
[
MV_FWD_X0
],
&
h
->
mv
[
MV_FWD_X2
]);
bs
[
7
]
=
get_bs_p
(
&
h
->
mv
[
MV_FWD_X1
],
&
h
->
mv
[
MV_FWD_X3
]);
case
P_16X16
:
case
P_SKIP
:
bs
[
0
]
=
get_bs_p
(
&
h
->
mv
[
MV_FWD_A1
],
&
h
->
mv
[
MV_FWD_X0
]);
bs
[
1
]
=
get_bs_p
(
&
h
->
mv
[
MV_FWD_A3
],
&
h
->
mv
[
MV_FWD_X2
]);
bs
[
4
]
=
get_bs_p
(
&
h
->
mv
[
MV_FWD_B2
],
&
h
->
mv
[
MV_FWD_X0
]);
bs
[
5
]
=
get_bs_p
(
&
h
->
mv
[
MV_FWD_B3
],
&
h
->
mv
[
MV_FWD_X1
]);
break
;
case
B_SKIP
:
case
B_DIRECT
:
case
B_8X8
:
bs
[
2
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_X0
],
&
h
->
mv
[
MV_FWD_X1
]);
bs
[
3
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_X2
],
&
h
->
mv
[
MV_FWD_X3
]);
bs
[
6
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_X0
],
&
h
->
mv
[
MV_FWD_X2
]);
bs
[
7
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_X1
],
&
h
->
mv
[
MV_FWD_X3
]);
case
B_FWD_16X16
:
case
B_BWD_16X16
:
case
B_SYM_16X16
:
bs
[
0
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_A1
],
&
h
->
mv
[
MV_FWD_X0
]);
bs
[
1
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_A3
],
&
h
->
mv
[
MV_FWD_X2
]);
bs
[
4
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_B2
],
&
h
->
mv
[
MV_FWD_X0
]);
bs
[
5
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_B3
],
&
h
->
mv
[
MV_FWD_X1
]);
break
;
default:
if
(
mb_type
&
1
)
{
//16X8
bs
[
6
]
=
bs
[
7
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_X0
],
&
h
->
mv
[
MV_FWD_X2
]);
}
else
{
//8X16
bs
[
2
]
=
bs
[
3
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_X0
],
&
h
->
mv
[
MV_FWD_X1
]);
}
}
bs
[
0
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_A1
],
&
h
->
mv
[
MV_FWD_X0
]);
if
(
partition_flags
[
mb_type
]
&
SPLITH
){
bs
[
1
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_A3
],
&
h
->
mv
[
MV_FWD_X2
]);
bs
[
6
]
=
get_bs
(
&
h
->
mv
[
MV_FWD_X0
],
&
h
->
mv
[
MV_FWD_X2
],
mb_type
>
P_8X8
);
bs
[
4
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_B2
],
&
h
->
mv
[
MV_FWD_X0
]);
bs
[
7
]
=
get_bs
(
&
h
->
mv
[
MV_FWD_X1
],
&
h
->
mv
[
MV_FWD_X3
],
mb_type
>
P_8X8
);
bs
[
5
]
=
get_bs_b
(
&
h
->
mv
[
MV_FWD_B3
],
&
h
->
mv
[
MV_FWD_X1
]);
}
bs
[
0
]
=
get_bs
(
&
h
->
mv
[
MV_FWD_A1
],
&
h
->
mv
[
MV_FWD_X0
],
mb_type
>
P_8X8
);
bs
[
1
]
=
get_bs
(
&
h
->
mv
[
MV_FWD_A3
],
&
h
->
mv
[
MV_FWD_X2
],
mb_type
>
P_8X8
);
bs
[
4
]
=
get_bs
(
&
h
->
mv
[
MV_FWD_B2
],
&
h
->
mv
[
MV_FWD_X0
],
mb_type
>
P_8X8
);
bs
[
5
]
=
get_bs
(
&
h
->
mv
[
MV_FWD_B3
],
&
h
->
mv
[
MV_FWD_X1
],
mb_type
>
P_8X8
);
}
}
if
(
*
((
uint64_t
*
)
bs
)
)
{
if
(
*
((
uint64_t
*
)
bs
)
)
{
if
(
h
->
flags
&
A_AVAIL
)
{
if
(
h
->
flags
&
A_AVAIL
)
{
...
@@ -486,19 +449,13 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de
...
@@ -486,19 +449,13 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de
}
}
static
void
inter_pred
(
AVSContext
*
h
,
enum
mb_t
mb_type
)
{
static
void
inter_pred
(
AVSContext
*
h
,
enum
mb_t
mb_type
)
{
switch
(
mb_type
)
{
if
(
partition_flags
[
mb_type
]
==
0
){
// 16x16
case
P_SKIP
:
case
P_16X16
:
case
B_FWD_16X16
:
case
B_BWD_16X16
:
case
B_SYM_16X16
:
mc_part_std
(
h
,
1
,
8
,
0
,
h
->
cy
,
h
->
cu
,
h
->
cv
,
0
,
0
,
mc_part_std
(
h
,
1
,
8
,
0
,
h
->
cy
,
h
->
cu
,
h
->
cv
,
0
,
0
,
h
->
s
.
dsp
.
put_cavs_qpel_pixels_tab
[
0
],
h
->
s
.
dsp
.
put_cavs_qpel_pixels_tab
[
0
],
h
->
s
.
dsp
.
put_h264_chroma_pixels_tab
[
0
],
h
->
s
.
dsp
.
put_h264_chroma_pixels_tab
[
0
],
h
->
s
.
dsp
.
avg_cavs_qpel_pixels_tab
[
0
],
h
->
s
.
dsp
.
avg_cavs_qpel_pixels_tab
[
0
],
h
->
s
.
dsp
.
avg_h264_chroma_pixels_tab
[
0
],
&
h
->
mv
[
MV_FWD_X0
]);
h
->
s
.
dsp
.
avg_h264_chroma_pixels_tab
[
0
],
&
h
->
mv
[
MV_FWD_X0
]);
break
;
}
else
{
default
:
mc_part_std
(
h
,
1
,
4
,
0
,
h
->
cy
,
h
->
cu
,
h
->
cv
,
0
,
0
,
mc_part_std
(
h
,
1
,
4
,
0
,
h
->
cy
,
h
->
cu
,
h
->
cv
,
0
,
0
,
h
->
s
.
dsp
.
put_cavs_qpel_pixels_tab
[
1
],
h
->
s
.
dsp
.
put_cavs_qpel_pixels_tab
[
1
],
h
->
s
.
dsp
.
put_h264_chroma_pixels_tab
[
1
],
h
->
s
.
dsp
.
put_h264_chroma_pixels_tab
[
1
],
...
@@ -519,7 +476,6 @@ static void inter_pred(AVSContext *h, enum mb_t mb_type) {
...
@@ -519,7 +476,6 @@ static void inter_pred(AVSContext *h, enum mb_t mb_type) {
h
->
s
.
dsp
.
put_h264_chroma_pixels_tab
[
1
],
h
->
s
.
dsp
.
put_h264_chroma_pixels_tab
[
1
],
h
->
s
.
dsp
.
avg_cavs_qpel_pixels_tab
[
1
],
h
->
s
.
dsp
.
avg_cavs_qpel_pixels_tab
[
1
],
h
->
s
.
dsp
.
avg_h264_chroma_pixels_tab
[
1
],
&
h
->
mv
[
MV_FWD_X3
]);
h
->
s
.
dsp
.
avg_h264_chroma_pixels_tab
[
1
],
&
h
->
mv
[
MV_FWD_X3
]);
break
;
}
}
/* set intra prediction modes to default values */
/* set intra prediction modes to default values */
h
->
pred_mode_Y
[
3
]
=
h
->
pred_mode_Y
[
6
]
=
INTRA_L_LP
;
h
->
pred_mode_Y
[
3
]
=
h
->
pred_mode_Y
[
6
]
=
INTRA_L_LP
;
...
@@ -1102,7 +1058,7 @@ static void decode_mb_b(AVSContext *h, enum mb_t mb_type) {
...
@@ -1102,7 +1058,7 @@ static void decode_mb_b(AVSContext *h, enum mb_t mb_type) {
break
;
break
;
default:
default:
assert
((
mb_type
>
B_SYM_16X16
)
&&
(
mb_type
<
B_8X8
));
assert
((
mb_type
>
B_SYM_16X16
)
&&
(
mb_type
<
B_8X8
));
flags
=
b_partition_flags
[(
mb_type
-
1
)
>>
1
];
flags
=
partition_flags
[
mb_type
];
if
(
mb_type
&
1
)
{
/* 16x8 macroblock types */
if
(
mb_type
&
1
)
{
/* 16x8 macroblock types */
if
(
flags
&
FWD0
)
if
(
flags
&
FWD0
)
mv_pred
(
h
,
MV_FWD_X0
,
MV_FWD_C2
,
MV_PRED_TOP
,
BLK_16X8
,
1
);
mv_pred
(
h
,
MV_FWD_X0
,
MV_FWD_C2
,
MV_PRED_TOP
,
BLK_16X8
,
1
);
...
...
libavcodec/cavsdata.h
View file @
69f34e5b
...
@@ -41,6 +41,8 @@
...
@@ -41,6 +41,8 @@
#define BWD1 0x08
#define BWD1 0x08
#define SYM0 0x10
#define SYM0 0x10
#define SYM1 0x20
#define SYM1 0x20
#define SPLITH 0x40
#define SPLITV 0x80
#define MV_BWD_OFFS 12
#define MV_BWD_OFFS 12
#define MV_STRIDE 4
#define MV_STRIDE 4
...
@@ -127,17 +129,37 @@ enum mv_loc_t {
...
@@ -127,17 +129,37 @@ enum mv_loc_t {
MV_BWD_X3
MV_BWD_X3
};
};
static
const
uint8_t
b_partition_flags
[
14
]
=
{
static
const
uint8_t
partition_flags
[
30
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
//I_8X8
FWD0
|
FWD1
,
0
,
//P_SKIP
BWD0
|
BWD1
,
0
,
//P_16X16
FWD0
|
BWD1
,
SPLITH
,
//P_16X8
BWD0
|
FWD1
,
SPLITV
,
//P_8X16
FWD0
|
SYM1
,
SPLITH
|
SPLITV
,
//P_8X8
BWD0
|
SYM1
,
SPLITH
|
SPLITV
,
//B_SKIP
SYM0
|
FWD1
,
SPLITH
|
SPLITV
,
//B_DIRECT
SYM0
|
BWD1
,
0
,
//B_FWD_16X16
SYM0
|
SYM1
0
,
//B_BWD_16X16
0
,
//B_SYM_16X16
FWD0
|
FWD1
|
SPLITH
,
FWD0
|
FWD1
|
SPLITV
,
BWD0
|
BWD1
|
SPLITH
,
BWD0
|
BWD1
|
SPLITV
,
FWD0
|
BWD1
|
SPLITH
,
FWD0
|
BWD1
|
SPLITV
,
BWD0
|
FWD1
|
SPLITH
,
BWD0
|
FWD1
|
SPLITV
,
FWD0
|
SYM1
|
SPLITH
,
FWD0
|
SYM1
|
SPLITV
,
BWD0
|
SYM1
|
SPLITH
,
BWD0
|
SYM1
|
SPLITV
,
SYM0
|
FWD1
|
SPLITH
,
SYM0
|
FWD1
|
SPLITV
,
SYM0
|
BWD1
|
SPLITH
,
SYM0
|
BWD1
|
SPLITV
,
SYM0
|
SYM1
|
SPLITH
,
SYM0
|
SYM1
|
SPLITV
,
SPLITH
|
SPLITV
,
//B_8X8 = 29
};
};
static
const
uint8_t
scan3x3
[
4
]
=
{
4
,
5
,
7
,
8
};
static
const
uint8_t
scan3x3
[
4
]
=
{
4
,
5
,
7
,
8
};
...
...
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