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
e026ee04
Commit
e026ee04
authored
Nov 26, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpeg4videodec: move sprite_{shift,traj} from MpegEncContext to Mpeg4DecContext
parent
513d849b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
27 deletions
+29
-27
mpeg4video.h
libavcodec/mpeg4video.h
+4
-0
mpeg4videodec.c
libavcodec/mpeg4videodec.c
+23
-23
mpegvideo.h
libavcodec/mpegvideo.h
+0
-2
vaapi_mpeg4.c
libavcodec/vaapi_mpeg4.c
+2
-2
No files found.
libavcodec/mpeg4video.h
View file @
e026ee04
...
@@ -68,6 +68,10 @@ typedef struct Mpeg4DecContext {
...
@@ -68,6 +68,10 @@ typedef struct Mpeg4DecContext {
int
vol_sprite_usage
;
int
vol_sprite_usage
;
int
sprite_brightness_change
;
int
sprite_brightness_change
;
int
num_sprite_warping_points
;
int
num_sprite_warping_points
;
///< sprite trajectory points
uint16_t
sprite_traj
[
4
][
2
];
///< sprite shift [isChroma]
int
sprite_shift
[
2
];
// reversible vlc
// reversible vlc
int
rvlc
;
int
rvlc
;
...
...
libavcodec/mpeg4videodec.c
View file @
e026ee04
...
@@ -188,11 +188,11 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
...
@@ -188,11 +188,11 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
y
=
get_xbits
(
gb
,
length
);
y
=
get_xbits
(
gb
,
length
);
skip_bits1
(
gb
);
/* marker bit */
skip_bits1
(
gb
);
/* marker bit */
s
->
sprite_traj
[
i
][
0
]
=
d
[
i
][
0
]
=
x
;
ctx
->
sprite_traj
[
i
][
0
]
=
d
[
i
][
0
]
=
x
;
s
->
sprite_traj
[
i
][
1
]
=
d
[
i
][
1
]
=
y
;
ctx
->
sprite_traj
[
i
][
1
]
=
d
[
i
][
1
]
=
y
;
}
}
for
(;
i
<
4
;
i
++
)
for
(;
i
<
4
;
i
++
)
s
->
sprite_traj
[
i
][
0
]
=
s
->
sprite_traj
[
i
][
1
]
=
0
;
ctx
->
sprite_traj
[
i
][
0
]
=
ctx
->
sprite_traj
[
i
][
1
]
=
0
;
while
((
1
<<
alpha
)
<
w
)
while
((
1
<<
alpha
)
<
w
)
alpha
++
;
alpha
++
;
...
@@ -250,8 +250,8 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
...
@@ -250,8 +250,8 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
s
->
sprite_delta
[
0
][
1
]
=
s
->
sprite_delta
[
0
][
1
]
=
s
->
sprite_delta
[
1
][
0
]
=
0
;
s
->
sprite_delta
[
1
][
0
]
=
0
;
s
->
sprite_delta
[
1
][
1
]
=
a
;
s
->
sprite_delta
[
1
][
1
]
=
a
;
s
->
sprite_shift
[
0
]
=
ctx
->
sprite_shift
[
0
]
=
s
->
sprite_shift
[
1
]
=
0
;
ctx
->
sprite_shift
[
1
]
=
0
;
break
;
break
;
case
1
:
// GMC only
case
1
:
// GMC only
s
->
sprite_offset
[
0
][
0
]
=
sprite_ref
[
0
][
0
]
-
a
*
vop_ref
[
0
][
0
];
s
->
sprite_offset
[
0
][
0
]
=
sprite_ref
[
0
][
0
]
-
a
*
vop_ref
[
0
][
0
];
...
@@ -264,8 +264,8 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
...
@@ -264,8 +264,8 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
s
->
sprite_delta
[
0
][
1
]
=
s
->
sprite_delta
[
0
][
1
]
=
s
->
sprite_delta
[
1
][
0
]
=
0
;
s
->
sprite_delta
[
1
][
0
]
=
0
;
s
->
sprite_delta
[
1
][
1
]
=
a
;
s
->
sprite_delta
[
1
][
1
]
=
a
;
s
->
sprite_shift
[
0
]
=
ctx
->
sprite_shift
[
0
]
=
s
->
sprite_shift
[
1
]
=
0
;
ctx
->
sprite_shift
[
1
]
=
0
;
break
;
break
;
case
2
:
case
2
:
s
->
sprite_offset
[
0
][
0
]
=
(
sprite_ref
[
0
][
0
]
<<
(
alpha
+
rho
))
+
s
->
sprite_offset
[
0
][
0
]
=
(
sprite_ref
[
0
][
0
]
<<
(
alpha
+
rho
))
+
...
@@ -293,8 +293,8 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
...
@@ -293,8 +293,8 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
s
->
sprite_delta
[
1
][
0
]
=
(
-
r
*
sprite_ref
[
0
][
1
]
+
virtual_ref
[
0
][
1
]);
s
->
sprite_delta
[
1
][
0
]
=
(
-
r
*
sprite_ref
[
0
][
1
]
+
virtual_ref
[
0
][
1
]);
s
->
sprite_delta
[
1
][
1
]
=
(
-
r
*
sprite_ref
[
0
][
0
]
+
virtual_ref
[
0
][
0
]);
s
->
sprite_delta
[
1
][
1
]
=
(
-
r
*
sprite_ref
[
0
][
0
]
+
virtual_ref
[
0
][
0
]);
s
->
sprite_shift
[
0
]
=
alpha
+
rho
;
ctx
->
sprite_shift
[
0
]
=
alpha
+
rho
;
s
->
sprite_shift
[
1
]
=
alpha
+
rho
+
2
;
ctx
->
sprite_shift
[
1
]
=
alpha
+
rho
+
2
;
break
;
break
;
case
3
:
case
3
:
min_ab
=
FFMIN
(
alpha
,
beta
);
min_ab
=
FFMIN
(
alpha
,
beta
);
...
@@ -329,35 +329,35 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
...
@@ -329,35 +329,35 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
s
->
sprite_delta
[
1
][
0
]
=
(
-
r
*
sprite_ref
[
0
][
1
]
+
virtual_ref
[
0
][
1
])
*
h3
;
s
->
sprite_delta
[
1
][
0
]
=
(
-
r
*
sprite_ref
[
0
][
1
]
+
virtual_ref
[
0
][
1
])
*
h3
;
s
->
sprite_delta
[
1
][
1
]
=
(
-
r
*
sprite_ref
[
0
][
1
]
+
virtual_ref
[
1
][
1
])
*
w3
;
s
->
sprite_delta
[
1
][
1
]
=
(
-
r
*
sprite_ref
[
0
][
1
]
+
virtual_ref
[
1
][
1
])
*
w3
;
s
->
sprite_shift
[
0
]
=
alpha
+
beta
+
rho
-
min_ab
;
ctx
->
sprite_shift
[
0
]
=
alpha
+
beta
+
rho
-
min_ab
;
s
->
sprite_shift
[
1
]
=
alpha
+
beta
+
rho
-
min_ab
+
2
;
ctx
->
sprite_shift
[
1
]
=
alpha
+
beta
+
rho
-
min_ab
+
2
;
break
;
break
;
}
}
/* try to simplify the situation */
/* try to simplify the situation */
if
(
s
->
sprite_delta
[
0
][
0
]
==
a
<<
s
->
sprite_shift
[
0
]
&&
if
(
s
->
sprite_delta
[
0
][
0
]
==
a
<<
ctx
->
sprite_shift
[
0
]
&&
s
->
sprite_delta
[
0
][
1
]
==
0
&&
s
->
sprite_delta
[
0
][
1
]
==
0
&&
s
->
sprite_delta
[
1
][
0
]
==
0
&&
s
->
sprite_delta
[
1
][
0
]
==
0
&&
s
->
sprite_delta
[
1
][
1
]
==
a
<<
s
->
sprite_shift
[
0
])
{
s
->
sprite_delta
[
1
][
1
]
==
a
<<
ctx
->
sprite_shift
[
0
])
{
s
->
sprite_offset
[
0
][
0
]
>>=
s
->
sprite_shift
[
0
];
s
->
sprite_offset
[
0
][
0
]
>>=
ctx
->
sprite_shift
[
0
];
s
->
sprite_offset
[
0
][
1
]
>>=
s
->
sprite_shift
[
0
];
s
->
sprite_offset
[
0
][
1
]
>>=
ctx
->
sprite_shift
[
0
];
s
->
sprite_offset
[
1
][
0
]
>>=
s
->
sprite_shift
[
1
];
s
->
sprite_offset
[
1
][
0
]
>>=
ctx
->
sprite_shift
[
1
];
s
->
sprite_offset
[
1
][
1
]
>>=
s
->
sprite_shift
[
1
];
s
->
sprite_offset
[
1
][
1
]
>>=
ctx
->
sprite_shift
[
1
];
s
->
sprite_delta
[
0
][
0
]
=
a
;
s
->
sprite_delta
[
0
][
0
]
=
a
;
s
->
sprite_delta
[
0
][
1
]
=
0
;
s
->
sprite_delta
[
0
][
1
]
=
0
;
s
->
sprite_delta
[
1
][
0
]
=
0
;
s
->
sprite_delta
[
1
][
0
]
=
0
;
s
->
sprite_delta
[
1
][
1
]
=
a
;
s
->
sprite_delta
[
1
][
1
]
=
a
;
s
->
sprite_shift
[
0
]
=
0
;
ctx
->
sprite_shift
[
0
]
=
0
;
s
->
sprite_shift
[
1
]
=
0
;
ctx
->
sprite_shift
[
1
]
=
0
;
s
->
real_sprite_warping_points
=
1
;
s
->
real_sprite_warping_points
=
1
;
}
else
{
}
else
{
int
shift_y
=
16
-
s
->
sprite_shift
[
0
];
int
shift_y
=
16
-
ctx
->
sprite_shift
[
0
];
int
shift_c
=
16
-
s
->
sprite_shift
[
1
];
int
shift_c
=
16
-
ctx
->
sprite_shift
[
1
];
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
s
->
sprite_offset
[
0
][
i
]
<<=
shift_y
;
s
->
sprite_offset
[
0
][
i
]
<<=
shift_y
;
s
->
sprite_offset
[
1
][
i
]
<<=
shift_c
;
s
->
sprite_offset
[
1
][
i
]
<<=
shift_c
;
s
->
sprite_delta
[
0
][
i
]
<<=
shift_y
;
s
->
sprite_delta
[
0
][
i
]
<<=
shift_y
;
s
->
sprite_delta
[
1
][
i
]
<<=
shift_y
;
s
->
sprite_delta
[
1
][
i
]
<<=
shift_y
;
s
->
sprite_shift
[
i
]
=
16
;
ctx
->
sprite_shift
[
i
]
=
16
;
}
}
s
->
real_sprite_warping_points
=
ctx
->
num_sprite_warping_points
;
s
->
real_sprite_warping_points
=
ctx
->
num_sprite_warping_points
;
}
}
...
@@ -493,7 +493,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n)
...
@@ -493,7 +493,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n)
}
else
{
}
else
{
dx
=
s
->
sprite_delta
[
n
][
0
];
dx
=
s
->
sprite_delta
[
n
][
0
];
dy
=
s
->
sprite_delta
[
n
][
1
];
dy
=
s
->
sprite_delta
[
n
][
1
];
shift
=
s
->
sprite_shift
[
0
];
shift
=
ctx
->
sprite_shift
[
0
];
if
(
n
)
if
(
n
)
dy
-=
1
<<
(
shift
+
a
+
1
);
dy
-=
1
<<
(
shift
+
a
+
1
);
else
else
...
...
libavcodec/mpegvideo.h
View file @
e026ee04
...
@@ -580,10 +580,8 @@ typedef struct MpegEncContext {
...
@@ -580,10 +580,8 @@ typedef struct MpegEncContext {
uint16_t
pp_field_time
;
uint16_t
pp_field_time
;
uint16_t
pb_field_time
;
///< like above, just for interlaced
uint16_t
pb_field_time
;
///< like above, just for interlaced
int
real_sprite_warping_points
;
int
real_sprite_warping_points
;
uint16_t
sprite_traj
[
4
][
2
];
///< sprite trajectory points
int
sprite_offset
[
2
][
2
];
///< sprite offset[isChroma][isMVY]
int
sprite_offset
[
2
][
2
];
///< sprite offset[isChroma][isMVY]
int
sprite_delta
[
2
][
2
];
///< sprite_delta [isY][isMVY]
int
sprite_delta
[
2
][
2
];
///< sprite_delta [isY][isMVY]
int
sprite_shift
[
2
];
///< sprite shift [isChroma]
int
mcsel
;
int
mcsel
;
int
quant_precision
;
int
quant_precision
;
int
quarter_sample
;
///< 1->qpel, 0->half pel ME/MC
int
quarter_sample
;
///< 1->qpel, 0->half pel ME/MC
...
...
libavcodec/vaapi_mpeg4.c
View file @
e026ee04
...
@@ -75,8 +75,8 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
...
@@ -75,8 +75,8 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param
->
vol_fields
.
bits
.
resync_marker_disable
=
!
ctx
->
resync_marker
;
pic_param
->
vol_fields
.
bits
.
resync_marker_disable
=
!
ctx
->
resync_marker
;
pic_param
->
no_of_sprite_warping_points
=
ctx
->
num_sprite_warping_points
;
pic_param
->
no_of_sprite_warping_points
=
ctx
->
num_sprite_warping_points
;
for
(
i
=
0
;
i
<
ctx
->
num_sprite_warping_points
&&
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
ctx
->
num_sprite_warping_points
&&
i
<
3
;
i
++
)
{
pic_param
->
sprite_trajectory_du
[
i
]
=
s
->
sprite_traj
[
i
][
0
];
pic_param
->
sprite_trajectory_du
[
i
]
=
ctx
->
sprite_traj
[
i
][
0
];
pic_param
->
sprite_trajectory_dv
[
i
]
=
s
->
sprite_traj
[
i
][
1
];
pic_param
->
sprite_trajectory_dv
[
i
]
=
ctx
->
sprite_traj
[
i
][
1
];
}
}
pic_param
->
quant_precision
=
s
->
quant_precision
;
pic_param
->
quant_precision
=
s
->
quant_precision
;
pic_param
->
vop_fields
.
value
=
0
;
/* reset all bits */
pic_param
->
vop_fields
.
value
=
0
;
/* reset all bits */
...
...
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