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
56bdf61b
Commit
56bdf61b
authored
Nov 12, 2015
by
Clément Bœsch
Committed by
Clément Bœsch
Nov 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/motion_vector: export subpel motion information
FATE test changes because of the switch from shift to division.
parent
c7b93388
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
36 deletions
+50
-36
mpegvideo.c
libavcodec/mpegvideo.c
+19
-15
snowdec.c
libavcodec/snowdec.c
+5
-2
motion_vector.h
libavutil/motion_vector.h
+7
-0
version.h
libavutil/version.h
+1
-1
filter-codecview-mvs
tests/ref/fate/filter-codecview-mvs
+18
-18
No files found.
libavcodec/mpegvideo.c
View file @
56bdf61b
...
...
@@ -1557,15 +1557,18 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex,
static
int
add_mb
(
AVMotionVector
*
mb
,
uint32_t
mb_type
,
int
dst_x
,
int
dst_y
,
int
src_x
,
int
src_y
,
int
motion_x
,
int
motion_y
,
int
motion_scale
,
int
direction
)
{
mb
->
w
=
IS_8X8
(
mb_type
)
||
IS_8X16
(
mb_type
)
?
8
:
16
;
mb
->
h
=
IS_8X8
(
mb_type
)
||
IS_16X8
(
mb_type
)
?
8
:
16
;
mb
->
src_x
=
src_x
;
mb
->
src_y
=
src_y
;
mb
->
motion_x
=
motion_x
;
mb
->
motion_y
=
motion_y
;
mb
->
motion_scale
=
motion_scale
;
mb
->
dst_x
=
dst_x
;
mb
->
dst_y
=
dst_y
;
mb
->
src_x
=
dst_x
+
motion_x
/
motion_scale
;
mb
->
src_y
=
dst_y
+
motion_y
/
motion_scale
;
mb
->
source
=
direction
?
1
:
-
1
;
mb
->
flags
=
0
;
// XXX: does mb_type contain extra information that could be exported here?
return
1
;
...
...
@@ -1581,6 +1584,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
{
if
((
avctx
->
flags2
&
AV_CODEC_FLAG2_EXPORT_MVS
)
&&
mbtype_table
&&
motion_val
[
0
])
{
const
int
shift
=
1
+
quarter_sample
;
const
int
scale
=
1
<<
shift
;
const
int
mv_sample_log2
=
avctx
->
codec_id
==
AV_CODEC_ID_H264
||
avctx
->
codec_id
==
AV_CODEC_ID_SVQ3
?
2
:
1
;
const
int
mv_stride
=
(
mb_width
<<
mv_sample_log2
)
+
(
avctx
->
codec
->
id
==
AV_CODEC_ID_H264
?
0
:
1
);
...
...
@@ -1604,43 +1608,43 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
int
sy
=
mb_y
*
16
+
4
+
8
*
(
i
>>
1
);
int
xy
=
(
mb_x
*
2
+
(
i
&
1
)
+
(
mb_y
*
2
+
(
i
>>
1
))
*
mv_stride
)
<<
(
mv_sample_log2
-
1
);
int
mx
=
(
motion_val
[
direction
][
xy
][
0
]
>>
shift
)
+
sx
;
int
my
=
(
motion_val
[
direction
][
xy
][
1
]
>>
shift
)
+
sy
;
mbcount
+=
add_mb
(
mvs
+
mbcount
,
mb_type
,
sx
,
sy
,
mx
,
my
,
direction
);
int
mx
=
motion_val
[
direction
][
xy
][
0
]
;
int
my
=
motion_val
[
direction
][
xy
][
1
]
;
mbcount
+=
add_mb
(
mvs
+
mbcount
,
mb_type
,
sx
,
sy
,
mx
,
my
,
scale
,
direction
);
}
}
else
if
(
IS_16X8
(
mb_type
))
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
int
sx
=
mb_x
*
16
+
8
;
int
sy
=
mb_y
*
16
+
4
+
8
*
i
;
int
xy
=
(
mb_x
*
2
+
(
mb_y
*
2
+
i
)
*
mv_stride
)
<<
(
mv_sample_log2
-
1
);
int
mx
=
(
motion_val
[
direction
][
xy
][
0
]
>>
shift
)
;
int
my
=
(
motion_val
[
direction
][
xy
][
1
]
>>
shift
)
;
int
mx
=
motion_val
[
direction
][
xy
][
0
]
;
int
my
=
motion_val
[
direction
][
xy
][
1
]
;
if
(
IS_INTERLACED
(
mb_type
))
my
*=
2
;
mbcount
+=
add_mb
(
mvs
+
mbcount
,
mb_type
,
sx
,
sy
,
mx
+
sx
,
my
+
sy
,
direction
);
mbcount
+=
add_mb
(
mvs
+
mbcount
,
mb_type
,
sx
,
sy
,
mx
,
my
,
scale
,
direction
);
}
}
else
if
(
IS_8X16
(
mb_type
))
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
int
sx
=
mb_x
*
16
+
4
+
8
*
i
;
int
sy
=
mb_y
*
16
+
8
;
int
xy
=
(
mb_x
*
2
+
i
+
mb_y
*
2
*
mv_stride
)
<<
(
mv_sample_log2
-
1
);
int
mx
=
motion_val
[
direction
][
xy
][
0
]
>>
shift
;
int
my
=
motion_val
[
direction
][
xy
][
1
]
>>
shift
;
int
mx
=
motion_val
[
direction
][
xy
][
0
];
int
my
=
motion_val
[
direction
][
xy
][
1
];
if
(
IS_INTERLACED
(
mb_type
))
my
*=
2
;
mbcount
+=
add_mb
(
mvs
+
mbcount
,
mb_type
,
sx
,
sy
,
mx
+
sx
,
my
+
sy
,
direction
);
mbcount
+=
add_mb
(
mvs
+
mbcount
,
mb_type
,
sx
,
sy
,
mx
,
my
,
scale
,
direction
);
}
}
else
{
int
sx
=
mb_x
*
16
+
8
;
int
sy
=
mb_y
*
16
+
8
;
int
xy
=
(
mb_x
+
mb_y
*
mv_stride
)
<<
mv_sample_log2
;
int
mx
=
(
motion_val
[
direction
][
xy
][
0
]
>>
shift
)
+
sx
;
int
my
=
(
motion_val
[
direction
][
xy
][
1
]
>>
shift
)
+
sy
;
mbcount
+=
add_mb
(
mvs
+
mbcount
,
mb_type
,
sx
,
sy
,
mx
,
my
,
direction
);
int
mx
=
motion_val
[
direction
][
xy
][
0
]
;
int
my
=
motion_val
[
direction
][
xy
][
1
]
;
mbcount
+=
add_mb
(
mvs
+
mbcount
,
mb_type
,
sx
,
sy
,
mx
,
my
,
scale
,
direction
);
}
}
}
...
...
libavcodec/snowdec.c
View file @
56bdf61b
...
...
@@ -104,8 +104,11 @@ static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer
avmv
->
h
=
block_h
;
avmv
->
dst_x
=
block_w
*
mb_x
-
block_w
/
2
;
avmv
->
dst_y
=
block_h
*
mb_y
-
block_h
/
2
;
avmv
->
src_x
=
avmv
->
dst_x
+
(
bn
->
mx
*
s
->
mv_scale
)
/
8
;
avmv
->
src_y
=
avmv
->
dst_y
+
(
bn
->
my
*
s
->
mv_scale
)
/
8
;
avmv
->
motion_scale
=
8
;
avmv
->
motion_x
=
bn
->
mx
*
s
->
mv_scale
;
avmv
->
motion_y
=
bn
->
my
*
s
->
mv_scale
;
avmv
->
src_x
=
avmv
->
dst_x
+
avmv
->
motion_x
/
8
;
avmv
->
src_y
=
avmv
->
dst_y
+
avmv
->
motion_y
/
8
;
avmv
->
source
=
-
1
-
bn
->
ref
;
avmv
->
flags
=
0
;
}
...
...
libavutil/motion_vector.h
View file @
56bdf61b
...
...
@@ -45,6 +45,13 @@ typedef struct AVMotionVector {
* Currently unused.
*/
uint64_t
flags
;
/**
* Motion vector
* src_x = dst_x + motion_x / motion_scale
* src_y = dst_y + motion_y / motion_scale
*/
int32_t
motion_x
,
motion_y
;
uint16_t
motion_scale
;
}
AVMotionVector
;
#endif
/* AVUTIL_MOTION_VECTOR_H */
libavutil/version.h
View file @
56bdf61b
...
...
@@ -56,7 +56,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 55
#define LIBAVUTIL_VERSION_MINOR
8
#define LIBAVUTIL_VERSION_MINOR
9
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
tests/ref/fate/filter-codecview-mvs
View file @
56bdf61b
...
...
@@ -39,23 +39,23 @@
0, 37, 37, 1, 276480, 0x5ce39368
0, 38, 38, 1, 276480, 0x4ec1e418
0, 39, 39, 1, 276480, 0x23c418ae
0, 40, 40, 1, 276480, 0x
499c55d6
0, 41, 41, 1, 276480, 0x
166ef020
0, 42, 42, 1, 276480, 0x
aa0614ab
0, 43, 43, 1, 276480, 0x
8bc2fa2b
0, 44, 44, 1, 276480, 0x
c9c873f7
0, 45, 45, 1, 276480, 0x
99838153
0, 46, 46, 1, 276480, 0x
32e5f45b
0, 40, 40, 1, 276480, 0x
036a5515
0, 41, 41, 1, 276480, 0x
7946efbd
0, 42, 42, 1, 276480, 0x
d9aa1382
0, 43, 43, 1, 276480, 0x
3863f9c8
0, 44, 44, 1, 276480, 0x
33e47330
0, 45, 45, 1, 276480, 0x
ff6e8038
0, 46, 46, 1, 276480, 0x
ed3ff087
0, 47, 47, 1, 276480, 0xe7834514
0, 48, 48, 1, 276480, 0x4
54c99c8
0, 49, 49, 1, 276480, 0x
e29bacc8
0, 50, 50, 1, 276480, 0x
6b79c3d
3
0, 51, 51, 1, 276480, 0x
284d358e
0, 52, 52, 1, 276480, 0x
17552cd4
0, 48, 48, 1, 276480, 0x4
d5d909d
0, 49, 49, 1, 276480, 0x
82eea962
0, 50, 50, 1, 276480, 0x
8075bca
3
0, 51, 51, 1, 276480, 0x
d5dc3185
0, 52, 52, 1, 276480, 0x
859e0490
0, 53, 53, 1, 276480, 0x6ceebf3e
0, 54, 54, 1, 276480, 0x
7ac8de3c
0, 55, 55, 1, 276480, 0x
14d6768c
0, 56, 56, 1, 276480, 0x
59891e5f
0, 57, 57, 1, 276480, 0x
ed3053ea
0, 58, 58, 1, 276480, 0x
9b0182c3
0, 59, 59, 1, 276480, 0x
f849eb88
0, 54, 54, 1, 276480, 0x
ada5d62d
0, 55, 55, 1, 276480, 0x
991a7628
0, 56, 56, 1, 276480, 0x
e169042a
0, 57, 57, 1, 276480, 0x
226e52c4
0, 58, 58, 1, 276480, 0x
a3fe775c
0, 59, 59, 1, 276480, 0x
6b80e99f
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