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
89a13998
Commit
89a13998
authored
Mar 23, 2016
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
svq3: rip out the svq3-relevant parts of pred_motion() out of h264
parent
8eecae77
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
1 deletion
+74
-1
svq3.c
libavcodec/svq3.c
+74
-1
No files found.
libavcodec/svq3.c
View file @
89a13998
...
...
@@ -311,6 +311,79 @@ static inline int svq3_decode_block(GetBitContext *gb, int16_t *block,
return
0
;
}
static
av_always_inline
int
svq3_fetch_diagonal_mv
(
const
H264Context
*
h
,
H264SliceContext
*
sl
,
const
int16_t
**
C
,
int
i
,
int
list
,
int
part_width
)
{
const
int
topright_ref
=
sl
->
ref_cache
[
list
][
i
-
8
+
part_width
];
if
(
topright_ref
!=
PART_NOT_AVAILABLE
)
{
*
C
=
sl
->
mv_cache
[
list
][
i
-
8
+
part_width
];
return
topright_ref
;
}
else
{
*
C
=
sl
->
mv_cache
[
list
][
i
-
8
-
1
];
return
sl
->
ref_cache
[
list
][
i
-
8
-
1
];
}
}
/**
* Get the predicted MV.
* @param n the block index
* @param part_width the width of the partition (4, 8,16) -> (1, 2, 4)
* @param mx the x component of the predicted motion vector
* @param my the y component of the predicted motion vector
*/
static
av_always_inline
void
svq3_pred_motion
(
const
H264Context
*
const
h
,
H264SliceContext
*
sl
,
int
n
,
int
part_width
,
int
list
,
int
ref
,
int
*
const
mx
,
int
*
const
my
)
{
const
int
index8
=
scan8
[
n
];
const
int
top_ref
=
sl
->
ref_cache
[
list
][
index8
-
8
];
const
int
left_ref
=
sl
->
ref_cache
[
list
][
index8
-
1
];
const
int16_t
*
const
A
=
sl
->
mv_cache
[
list
][
index8
-
1
];
const
int16_t
*
const
B
=
sl
->
mv_cache
[
list
][
index8
-
8
];
const
int16_t
*
C
;
int
diagonal_ref
,
match_count
;
/* mv_cache
* B . . A T T T T
* U . . L . . , .
* U . . L . . . .
* U . . L . . , .
* . . . L . . . .
*/
diagonal_ref
=
svq3_fetch_diagonal_mv
(
h
,
sl
,
&
C
,
index8
,
list
,
part_width
);
match_count
=
(
diagonal_ref
==
ref
)
+
(
top_ref
==
ref
)
+
(
left_ref
==
ref
);
if
(
match_count
>
1
)
{
//most common
*
mx
=
mid_pred
(
A
[
0
],
B
[
0
],
C
[
0
]);
*
my
=
mid_pred
(
A
[
1
],
B
[
1
],
C
[
1
]);
}
else
if
(
match_count
==
1
)
{
if
(
left_ref
==
ref
)
{
*
mx
=
A
[
0
];
*
my
=
A
[
1
];
}
else
if
(
top_ref
==
ref
)
{
*
mx
=
B
[
0
];
*
my
=
B
[
1
];
}
else
{
*
mx
=
C
[
0
];
*
my
=
C
[
1
];
}
}
else
{
if
(
top_ref
==
PART_NOT_AVAILABLE
&&
diagonal_ref
==
PART_NOT_AVAILABLE
&&
left_ref
!=
PART_NOT_AVAILABLE
)
{
*
mx
=
A
[
0
];
*
my
=
A
[
1
];
}
else
{
*
mx
=
mid_pred
(
A
[
0
],
B
[
0
],
C
[
0
]);
*
my
=
mid_pred
(
A
[
1
],
B
[
1
],
C
[
1
]);
}
}
}
static
inline
void
svq3_mc_dir_part
(
SVQ3Context
*
s
,
int
x
,
int
y
,
int
width
,
int
height
,
int
mx
,
int
my
,
int
dxy
,
...
...
@@ -409,7 +482,7 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
(
j
>>
1
&
4
)
+
(
i
&
8
);
if
(
mode
!=
PREDICT_MODE
)
{
pred_motion
(
h
,
sl
,
k
,
part_width
>>
2
,
dir
,
1
,
&
mx
,
&
my
);
svq3_
pred_motion
(
h
,
sl
,
k
,
part_width
>>
2
,
dir
,
1
,
&
mx
,
&
my
);
}
else
{
mx
=
s
->
next_pic
->
motion_val
[
0
][
b_xy
][
0
]
<<
1
;
my
=
s
->
next_pic
->
motion_val
[
0
][
b_xy
][
1
]
<<
1
;
...
...
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