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
a84616b7
Commit
a84616b7
authored
Oct 13, 2013
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegvideo: K&R formatting cosmetics
parent
93f30547
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
516 additions
and
449 deletions
+516
-449
mpegvideo_motion.c
libavcodec/mpegvideo_motion.c
+516
-449
No files found.
libavcodec/mpegvideo_motion.c
View file @
a84616b7
...
@@ -39,83 +39,98 @@ static void gmc1_motion(MpegEncContext *s,
...
@@ -39,83 +39,98 @@ static void gmc1_motion(MpegEncContext *s,
uint8_t
*
ptr
;
uint8_t
*
ptr
;
int
src_x
,
src_y
,
motion_x
,
motion_y
;
int
src_x
,
src_y
,
motion_x
,
motion_y
;
ptrdiff_t
offset
,
linesize
,
uvlinesize
;
ptrdiff_t
offset
,
linesize
,
uvlinesize
;
int
emu
=
0
;
int
emu
=
0
;
motion_x
=
s
->
sprite_offset
[
0
][
0
];
motion_x
=
s
->
sprite_offset
[
0
][
0
];
motion_y
=
s
->
sprite_offset
[
0
][
1
];
motion_y
=
s
->
sprite_offset
[
0
][
1
];
src_x
=
s
->
mb_x
*
16
+
(
motion_x
>>
(
s
->
sprite_warping_accuracy
+
1
));
src_x
=
s
->
mb_x
*
16
+
(
motion_x
>>
(
s
->
sprite_warping_accuracy
+
1
));
src_y
=
s
->
mb_y
*
16
+
(
motion_y
>>
(
s
->
sprite_warping_accuracy
+
1
));
src_y
=
s
->
mb_y
*
16
+
(
motion_y
>>
(
s
->
sprite_warping_accuracy
+
1
));
motion_x
<<=
(
3
-
s
->
sprite_warping_accuracy
);
motion_x
<<=
(
3
-
s
->
sprite_warping_accuracy
);
motion_y
<<=
(
3
-
s
->
sprite_warping_accuracy
);
motion_y
<<=
(
3
-
s
->
sprite_warping_accuracy
);
src_x
=
av_clip
(
src_x
,
-
16
,
s
->
width
);
src_x
=
av_clip
(
src_x
,
-
16
,
s
->
width
);
if
(
src_x
==
s
->
width
)
if
(
src_x
==
s
->
width
)
motion_x
=
0
;
motion_x
=
0
;
src_y
=
av_clip
(
src_y
,
-
16
,
s
->
height
);
src_y
=
av_clip
(
src_y
,
-
16
,
s
->
height
);
if
(
src_y
==
s
->
height
)
if
(
src_y
==
s
->
height
)
motion_y
=
0
;
motion_y
=
0
;
linesize
=
s
->
linesize
;
linesize
=
s
->
linesize
;
uvlinesize
=
s
->
uvlinesize
;
uvlinesize
=
s
->
uvlinesize
;
ptr
=
ref_picture
[
0
]
+
(
src_y
*
linesize
)
+
src_x
;
ptr
=
ref_picture
[
0
]
+
src_y
*
linesize
+
src_x
;
if
(
s
->
flags
&
CODEC_FLAG_EMU_EDGE
){
if
(
s
->
flags
&
CODEC_FLAG_EMU_EDGE
)
{
if
(
(
unsigned
)
src_x
>=
FFMAX
(
s
->
h_edge_pos
-
17
,
0
)
if
((
unsigned
)
src_x
>=
FFMAX
(
s
->
h_edge_pos
-
17
,
0
)
||
||
(
unsigned
)
src_y
>=
FFMAX
(
s
->
v_edge_pos
-
17
,
0
)){
(
unsigned
)
src_y
>=
FFMAX
(
s
->
v_edge_pos
-
17
,
0
))
{
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr
,
linesize
,
17
,
17
,
src_x
,
src_y
,
s
->
h_edge_pos
,
s
->
v_edge_pos
);
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr
,
ptr
=
s
->
edge_emu_buffer
;
linesize
,
17
,
17
,
src_x
,
src_y
,
s
->
h_edge_pos
,
s
->
v_edge_pos
);
ptr
=
s
->
edge_emu_buffer
;
}
}
}
}
if
((
motion_x
|
motion_y
)
&
7
){
if
((
motion_x
|
motion_y
)
&
7
)
{
s
->
dsp
.
gmc1
(
dest_y
,
ptr
,
linesize
,
16
,
motion_x
&
15
,
motion_y
&
15
,
128
-
s
->
no_rounding
);
s
->
dsp
.
gmc1
(
dest_y
,
ptr
,
linesize
,
16
,
s
->
dsp
.
gmc1
(
dest_y
+
8
,
ptr
+
8
,
linesize
,
16
,
motion_x
&
15
,
motion_y
&
15
,
128
-
s
->
no_rounding
);
motion_x
&
15
,
motion_y
&
15
,
128
-
s
->
no_rounding
);
}
else
{
s
->
dsp
.
gmc1
(
dest_y
+
8
,
ptr
+
8
,
linesize
,
16
,
motion_x
&
15
,
motion_y
&
15
,
128
-
s
->
no_rounding
);
}
else
{
int
dxy
;
int
dxy
;
dxy
=
((
motion_x
>>
3
)
&
1
)
|
((
motion_y
>>
2
)
&
2
);
dxy
=
((
motion_x
>>
3
)
&
1
)
|
((
motion_y
>>
2
)
&
2
);
if
(
s
->
no_rounding
){
if
(
s
->
no_rounding
)
{
s
->
hdsp
.
put_no_rnd_pixels_tab
[
0
][
dxy
](
dest_y
,
ptr
,
linesize
,
16
);
s
->
hdsp
.
put_no_rnd_pixels_tab
[
0
][
dxy
](
dest_y
,
ptr
,
linesize
,
16
);
}
else
{
}
else
{
s
->
hdsp
.
put_pixels_tab
[
0
][
dxy
](
dest_y
,
ptr
,
linesize
,
16
);
s
->
hdsp
.
put_pixels_tab
[
0
][
dxy
](
dest_y
,
ptr
,
linesize
,
16
);
}
}
}
}
if
(
CONFIG_GRAY
&&
s
->
flags
&
CODEC_FLAG_GRAY
)
return
;
if
(
CONFIG_GRAY
&&
s
->
flags
&
CODEC_FLAG_GRAY
)
return
;
motion_x
=
s
->
sprite_offset
[
1
][
0
];
motion_y
=
s
->
sprite_offset
[
1
][
1
];
motion_x
=
s
->
sprite_offset
[
1
][
0
];
src_x
=
s
->
mb_x
*
8
+
(
motion_x
>>
(
s
->
sprite_warping_accuracy
+
1
));
motion_y
=
s
->
sprite_offset
[
1
][
1
];
src_y
=
s
->
mb_y
*
8
+
(
motion_y
>>
(
s
->
sprite_warping_accuracy
+
1
));
src_x
=
s
->
mb_x
*
8
+
(
motion_x
>>
(
s
->
sprite_warping_accuracy
+
1
));
motion_x
<<=
(
3
-
s
->
sprite_warping_accuracy
);
src_y
=
s
->
mb_y
*
8
+
(
motion_y
>>
(
s
->
sprite_warping_accuracy
+
1
));
motion_y
<<=
(
3
-
s
->
sprite_warping_accuracy
);
motion_x
<<=
(
3
-
s
->
sprite_warping_accuracy
);
src_x
=
av_clip
(
src_x
,
-
8
,
s
->
width
>>
1
);
motion_y
<<=
(
3
-
s
->
sprite_warping_accuracy
);
if
(
src_x
==
s
->
width
>>
1
)
src_x
=
av_clip
(
src_x
,
-
8
,
s
->
width
>>
1
);
motion_x
=
0
;
if
(
src_x
==
s
->
width
>>
1
)
src_y
=
av_clip
(
src_y
,
-
8
,
s
->
height
>>
1
);
motion_x
=
0
;
if
(
src_y
==
s
->
height
>>
1
)
src_y
=
av_clip
(
src_y
,
-
8
,
s
->
height
>>
1
);
motion_y
=
0
;
if
(
src_y
==
s
->
height
>>
1
)
motion_y
=
0
;
offset
=
(
src_y
*
uvlinesize
)
+
src_x
;
offset
=
(
src_y
*
uvlinesize
)
+
src_x
;
ptr
=
ref_picture
[
1
]
+
offset
;
ptr
=
ref_picture
[
1
]
+
offset
;
if
(
s
->
flags
&
CODEC_FLAG_EMU_EDGE
){
if
(
s
->
flags
&
CODEC_FLAG_EMU_EDGE
)
{
if
(
(
unsigned
)
src_x
>=
FFMAX
((
s
->
h_edge_pos
>>
1
)
-
9
,
0
)
if
((
unsigned
)
src_x
>=
FFMAX
((
s
->
h_edge_pos
>>
1
)
-
9
,
0
)
||
||
(
unsigned
)
src_y
>=
FFMAX
((
s
->
v_edge_pos
>>
1
)
-
9
,
0
)){
(
unsigned
)
src_y
>=
FFMAX
((
s
->
v_edge_pos
>>
1
)
-
9
,
0
))
{
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr
,
uvlinesize
,
9
,
9
,
src_x
,
src_y
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr
,
ptr
=
s
->
edge_emu_buffer
;
uvlinesize
,
emu
=
1
;
9
,
9
,
src_x
,
src_y
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
ptr
=
s
->
edge_emu_buffer
;
emu
=
1
;
}
}
}
}
s
->
dsp
.
gmc1
(
dest_cb
,
ptr
,
uvlinesize
,
8
,
motion_x
&
15
,
motion_y
&
15
,
128
-
s
->
no_rounding
);
s
->
dsp
.
gmc1
(
dest_cb
,
ptr
,
uvlinesize
,
8
,
motion_x
&
15
,
motion_y
&
15
,
128
-
s
->
no_rounding
);
ptr
=
ref_picture
[
2
]
+
offset
;
ptr
=
ref_picture
[
2
]
+
offset
;
if
(
emu
){
if
(
emu
)
{
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr
,
uvlinesize
,
9
,
9
,
src_x
,
src_y
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr
,
ptr
=
s
->
edge_emu_buffer
;
uvlinesize
,
9
,
9
,
src_x
,
src_y
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
ptr
=
s
->
edge_emu_buffer
;
}
}
s
->
dsp
.
gmc1
(
dest_cr
,
ptr
,
uvlinesize
,
8
,
motion_x
&
15
,
motion_y
&
15
,
128
-
s
->
no_rounding
);
s
->
dsp
.
gmc1
(
dest_cr
,
ptr
,
uvlinesize
,
8
,
motion_x
&
15
,
motion_y
&
15
,
128
-
s
->
no_rounding
);
return
;
}
}
static
void
gmc_motion
(
MpegEncContext
*
s
,
static
void
gmc_motion
(
MpegEncContext
*
s
,
...
@@ -124,70 +139,72 @@ static void gmc_motion(MpegEncContext *s,
...
@@ -124,70 +139,72 @@ static void gmc_motion(MpegEncContext *s,
{
{
uint8_t
*
ptr
;
uint8_t
*
ptr
;
int
linesize
,
uvlinesize
;
int
linesize
,
uvlinesize
;
const
int
a
=
s
->
sprite_warping_accuracy
;
const
int
a
=
s
->
sprite_warping_accuracy
;
int
ox
,
oy
;
int
ox
,
oy
;
linesize
=
s
->
linesize
;
linesize
=
s
->
linesize
;
uvlinesize
=
s
->
uvlinesize
;
uvlinesize
=
s
->
uvlinesize
;
ptr
=
ref_picture
[
0
];
ptr
=
ref_picture
[
0
];
ox
=
s
->
sprite_offset
[
0
][
0
]
+
s
->
sprite_delta
[
0
][
0
]
*
s
->
mb_x
*
16
+
s
->
sprite_delta
[
0
][
1
]
*
s
->
mb_y
*
16
;
ox
=
s
->
sprite_offset
[
0
][
0
]
+
s
->
sprite_delta
[
0
][
0
]
*
s
->
mb_x
*
16
+
oy
=
s
->
sprite_offset
[
0
][
1
]
+
s
->
sprite_delta
[
1
][
0
]
*
s
->
mb_x
*
16
+
s
->
sprite_delta
[
1
][
1
]
*
s
->
mb_y
*
16
;
s
->
sprite_delta
[
0
][
1
]
*
s
->
mb_y
*
16
;
oy
=
s
->
sprite_offset
[
0
][
1
]
+
s
->
sprite_delta
[
1
][
0
]
*
s
->
mb_x
*
16
+
s
->
sprite_delta
[
1
][
1
]
*
s
->
mb_y
*
16
;
s
->
dsp
.
gmc
(
dest_y
,
ptr
,
linesize
,
16
,
s
->
dsp
.
gmc
(
dest_y
,
ptr
,
linesize
,
16
,
ox
,
ox
,
oy
,
oy
,
s
->
sprite_delta
[
0
][
0
],
s
->
sprite_delta
[
0
][
1
],
s
->
sprite_delta
[
0
][
0
],
s
->
sprite_delta
[
0
][
1
],
s
->
sprite_delta
[
1
][
0
],
s
->
sprite_delta
[
1
][
1
],
s
->
sprite_delta
[
1
][
0
],
s
->
sprite_delta
[
1
][
1
],
a
+
1
,
(
1
<<
(
2
*
a
+
1
))
-
s
->
no_rounding
,
a
+
1
,
(
1
<<
(
2
*
a
+
1
))
-
s
->
no_rounding
,
s
->
h_edge_pos
,
s
->
v_edge_pos
);
s
->
h_edge_pos
,
s
->
v_edge_pos
);
s
->
dsp
.
gmc
(
dest_y
+
8
,
ptr
,
linesize
,
16
,
s
->
dsp
.
gmc
(
dest_y
+
8
,
ptr
,
linesize
,
16
,
ox
+
s
->
sprite_delta
[
0
][
0
]
*
8
,
ox
+
s
->
sprite_delta
[
0
][
0
]
*
8
,
oy
+
s
->
sprite_delta
[
1
][
0
]
*
8
,
oy
+
s
->
sprite_delta
[
1
][
0
]
*
8
,
s
->
sprite_delta
[
0
][
0
],
s
->
sprite_delta
[
0
][
1
],
s
->
sprite_delta
[
0
][
0
],
s
->
sprite_delta
[
0
][
1
],
s
->
sprite_delta
[
1
][
0
],
s
->
sprite_delta
[
1
][
1
],
s
->
sprite_delta
[
1
][
0
],
s
->
sprite_delta
[
1
][
1
],
a
+
1
,
(
1
<<
(
2
*
a
+
1
))
-
s
->
no_rounding
,
a
+
1
,
(
1
<<
(
2
*
a
+
1
))
-
s
->
no_rounding
,
s
->
h_edge_pos
,
s
->
v_edge_pos
);
s
->
h_edge_pos
,
s
->
v_edge_pos
);
if
(
CONFIG_GRAY
&&
s
->
flags
&
CODEC_FLAG_GRAY
)
if
(
CONFIG_GRAY
&&
s
->
flags
&
CODEC_FLAG_GRAY
)
return
;
return
;
ox
=
s
->
sprite_offset
[
1
][
0
]
+
s
->
sprite_delta
[
0
][
0
]
*
s
->
mb_x
*
8
+
s
->
sprite_delta
[
0
][
1
]
*
s
->
mb_y
*
8
;
ox
=
s
->
sprite_offset
[
1
][
0
]
+
s
->
sprite_delta
[
0
][
0
]
*
s
->
mb_x
*
8
+
oy
=
s
->
sprite_offset
[
1
][
1
]
+
s
->
sprite_delta
[
1
][
0
]
*
s
->
mb_x
*
8
+
s
->
sprite_delta
[
1
][
1
]
*
s
->
mb_y
*
8
;
s
->
sprite_delta
[
0
][
1
]
*
s
->
mb_y
*
8
;
oy
=
s
->
sprite_offset
[
1
][
1
]
+
s
->
sprite_delta
[
1
][
0
]
*
s
->
mb_x
*
8
+
s
->
sprite_delta
[
1
][
1
]
*
s
->
mb_y
*
8
;
ptr
=
ref_picture
[
1
];
ptr
=
ref_picture
[
1
];
s
->
dsp
.
gmc
(
dest_cb
,
ptr
,
uvlinesize
,
8
,
s
->
dsp
.
gmc
(
dest_cb
,
ptr
,
uvlinesize
,
8
,
ox
,
ox
,
oy
,
oy
,
s
->
sprite_delta
[
0
][
0
],
s
->
sprite_delta
[
0
][
1
],
s
->
sprite_delta
[
0
][
0
],
s
->
sprite_delta
[
0
][
1
],
s
->
sprite_delta
[
1
][
0
],
s
->
sprite_delta
[
1
][
1
],
s
->
sprite_delta
[
1
][
0
],
s
->
sprite_delta
[
1
][
1
],
a
+
1
,
(
1
<<
(
2
*
a
+
1
))
-
s
->
no_rounding
,
a
+
1
,
(
1
<<
(
2
*
a
+
1
))
-
s
->
no_rounding
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
ptr
=
ref_picture
[
2
];
ptr
=
ref_picture
[
2
];
s
->
dsp
.
gmc
(
dest_cr
,
ptr
,
uvlinesize
,
8
,
s
->
dsp
.
gmc
(
dest_cr
,
ptr
,
uvlinesize
,
8
,
ox
,
ox
,
oy
,
oy
,
s
->
sprite_delta
[
0
][
0
],
s
->
sprite_delta
[
0
][
1
],
s
->
sprite_delta
[
0
][
0
],
s
->
sprite_delta
[
0
][
1
],
s
->
sprite_delta
[
1
][
0
],
s
->
sprite_delta
[
1
][
1
],
s
->
sprite_delta
[
1
][
0
],
s
->
sprite_delta
[
1
][
1
],
a
+
1
,
(
1
<<
(
2
*
a
+
1
))
-
s
->
no_rounding
,
a
+
1
,
(
1
<<
(
2
*
a
+
1
))
-
s
->
no_rounding
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
}
}
static
inline
int
hpel_motion
(
MpegEncContext
*
s
,
static
inline
int
hpel_motion
(
MpegEncContext
*
s
,
uint8_t
*
dest
,
uint8_t
*
src
,
uint8_t
*
dest
,
uint8_t
*
src
,
int
src_x
,
int
src_y
,
int
src_x
,
int
src_y
,
op_pixels_func
*
pix_op
,
op_pixels_func
*
pix_op
,
int
motion_x
,
int
motion_y
)
int
motion_x
,
int
motion_y
)
{
{
int
dxy
=
0
;
int
dxy
=
0
;
int
emu
=
0
;
int
emu
=
0
;
src_x
+=
motion_x
>>
1
;
src_x
+=
motion_x
>>
1
;
src_y
+=
motion_y
>>
1
;
src_y
+=
motion_y
>>
1
;
/* WARNING: do no forget half pels */
/* WARNING: do no forget half pels */
src_x
=
av_clip
(
src_x
,
-
16
,
s
->
width
);
//FIXME unneeded for emu?
src_x
=
av_clip
(
src_x
,
-
16
,
s
->
width
);
//
FIXME unneeded for emu?
if
(
src_x
!=
s
->
width
)
if
(
src_x
!=
s
->
width
)
dxy
|=
motion_x
&
1
;
dxy
|=
motion_x
&
1
;
src_y
=
av_clip
(
src_y
,
-
16
,
s
->
height
);
src_y
=
av_clip
(
src_y
,
-
16
,
s
->
height
);
...
@@ -195,13 +212,16 @@ static inline int hpel_motion(MpegEncContext *s,
...
@@ -195,13 +212,16 @@ static inline int hpel_motion(MpegEncContext *s,
dxy
|=
(
motion_y
&
1
)
<<
1
;
dxy
|=
(
motion_y
&
1
)
<<
1
;
src
+=
src_y
*
s
->
linesize
+
src_x
;
src
+=
src_y
*
s
->
linesize
+
src_x
;
if
(
s
->
unrestricted_mv
&&
(
s
->
flags
&
CODEC_FLAG_EMU_EDGE
)){
if
(
s
->
unrestricted_mv
&&
(
s
->
flags
&
CODEC_FLAG_EMU_EDGE
))
{
if
(
(
unsigned
)
src_x
>
FFMAX
(
s
->
h_edge_pos
-
(
motion_x
&
1
)
-
8
,
0
)
if
((
unsigned
)
src_x
>
FFMAX
(
s
->
h_edge_pos
-
(
motion_x
&
1
)
-
8
,
0
)
||
||
(
unsigned
)
src_y
>
FFMAX
(
s
->
v_edge_pos
-
(
motion_y
&
1
)
-
8
,
0
)){
(
unsigned
)
src_y
>
FFMAX
(
s
->
v_edge_pos
-
(
motion_y
&
1
)
-
8
,
0
))
{
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
src
,
s
->
linesize
,
9
,
9
,
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
src
,
src_x
,
src_y
,
s
->
h_edge_pos
,
s
->
v_edge_pos
);
s
->
linesize
,
src
=
s
->
edge_emu_buffer
;
9
,
9
,
emu
=
1
;
src_x
,
src_y
,
s
->
h_edge_pos
,
s
->
v_edge_pos
);
src
=
s
->
edge_emu_buffer
;
emu
=
1
;
}
}
}
}
pix_op
[
dxy
](
dest
,
src
,
s
->
linesize
,
8
);
pix_op
[
dxy
](
dest
,
src
,
s
->
linesize
,
8
);
...
@@ -210,10 +230,19 @@ static inline int hpel_motion(MpegEncContext *s,
...
@@ -210,10 +230,19 @@ static inline int hpel_motion(MpegEncContext *s,
static
av_always_inline
static
av_always_inline
void
mpeg_motion_internal
(
MpegEncContext
*
s
,
void
mpeg_motion_internal
(
MpegEncContext
*
s
,
uint8_t
*
dest_y
,
uint8_t
*
dest_cb
,
uint8_t
*
dest_cr
,
uint8_t
*
dest_y
,
int
field_based
,
int
bottom_field
,
int
field_select
,
uint8_t
*
dest_cb
,
uint8_t
**
ref_picture
,
op_pixels_func
(
*
pix_op
)[
4
],
uint8_t
*
dest_cr
,
int
motion_x
,
int
motion_y
,
int
h
,
int
is_mpeg12
,
int
mb_y
)
int
field_based
,
int
bottom_field
,
int
field_select
,
uint8_t
**
ref_picture
,
op_pixels_func
(
*
pix_op
)[
4
],
int
motion_x
,
int
motion_y
,
int
h
,
int
is_mpeg12
,
int
mb_y
)
{
{
uint8_t
*
ptr_y
,
*
ptr_cb
,
*
ptr_cr
;
uint8_t
*
ptr_y
,
*
ptr_cb
,
*
ptr_cr
;
int
dxy
,
uvdxy
,
mx
,
my
,
src_x
,
src_y
,
int
dxy
,
uvdxy
,
mx
,
my
,
src_x
,
src_y
,
...
@@ -221,56 +250,56 @@ void mpeg_motion_internal(MpegEncContext *s,
...
@@ -221,56 +250,56 @@ void mpeg_motion_internal(MpegEncContext *s,
ptrdiff_t
uvlinesize
,
linesize
;
ptrdiff_t
uvlinesize
,
linesize
;
#if 0
#if 0
if(s->quarter_sample)
if (s->quarter_sample) {
{
motion_x >>= 1;
motion_x>>=1;
motion_y >>= 1;
motion_y>>=1;
}
}
#endif
#endif
v_edge_pos
=
s
->
v_edge_pos
>>
field_based
;
v_edge_pos
=
s
->
v_edge_pos
>>
field_based
;
linesize
=
s
->
current_picture
.
f
.
linesize
[
0
]
<<
field_based
;
linesize
=
s
->
current_picture
.
f
.
linesize
[
0
]
<<
field_based
;
uvlinesize
=
s
->
current_picture
.
f
.
linesize
[
1
]
<<
field_based
;
uvlinesize
=
s
->
current_picture
.
f
.
linesize
[
1
]
<<
field_based
;
dxy
=
((
motion_y
&
1
)
<<
1
)
|
(
motion_x
&
1
);
dxy
=
((
motion_y
&
1
)
<<
1
)
|
(
motion_x
&
1
);
src_x
=
s
->
mb_x
*
16
+
(
motion_x
>>
1
);
src_x
=
s
->
mb_x
*
16
+
(
motion_x
>>
1
);
src_y
=
(
mb_y
<<
(
4
-
field_based
))
+
(
motion_y
>>
1
);
src_y
=
(
mb_y
<<
(
4
-
field_based
))
+
(
motion_y
>>
1
);
if
(
!
is_mpeg12
&&
s
->
out_format
==
FMT_H263
)
{
if
(
!
is_mpeg12
&&
s
->
out_format
==
FMT_H263
)
{
if
((
s
->
workaround_bugs
&
FF_BUG_HPEL_CHROMA
)
&&
field_based
)
{
if
((
s
->
workaround_bugs
&
FF_BUG_HPEL_CHROMA
)
&&
field_based
)
{
mx
=
(
motion_x
>>
1
)
|
(
motion_x
&
1
);
mx
=
(
motion_x
>>
1
)
|
(
motion_x
&
1
);
my
=
motion_y
>>
1
;
my
=
motion_y
>>
1
;
uvdxy
=
((
my
&
1
)
<<
1
)
|
(
mx
&
1
);
uvdxy
=
((
my
&
1
)
<<
1
)
|
(
mx
&
1
);
uvsrc_x
=
s
->
mb_x
*
8
+
(
mx
>>
1
);
uvsrc_x
=
s
->
mb_x
*
8
+
(
mx
>>
1
);
uvsrc_y
=
(
mb_y
<<
(
3
-
field_based
))
+
(
my
>>
1
);
uvsrc_y
=
(
mb_y
<<
(
3
-
field_based
))
+
(
my
>>
1
);
}
else
{
}
else
{
uvdxy
=
dxy
|
(
motion_y
&
2
)
|
((
motion_x
&
2
)
>>
1
);
uvdxy
=
dxy
|
(
motion_y
&
2
)
|
((
motion_x
&
2
)
>>
1
);
uvsrc_x
=
src_x
>>
1
;
uvsrc_x
=
src_x
>>
1
;
uvsrc_y
=
src_y
>>
1
;
uvsrc_y
=
src_y
>>
1
;
}
}
}
else
if
(
!
is_mpeg12
&&
s
->
out_format
==
FMT_H261
){
//even chroma mv's are full pel in H261
// Even chroma mv's are full pel in H261
mx
=
motion_x
/
4
;
}
else
if
(
!
is_mpeg12
&&
s
->
out_format
==
FMT_H261
)
{
my
=
motion_y
/
4
;
mx
=
motion_x
/
4
;
uvdxy
=
0
;
my
=
motion_y
/
4
;
uvsrc_x
=
s
->
mb_x
*
8
+
mx
;
uvdxy
=
0
;
uvsrc_y
=
mb_y
*
8
+
my
;
uvsrc_x
=
s
->
mb_x
*
8
+
mx
;
uvsrc_y
=
mb_y
*
8
+
my
;
}
else
{
}
else
{
if
(
s
->
chroma_y_shift
)
{
if
(
s
->
chroma_y_shift
)
{
mx
=
motion_x
/
2
;
mx
=
motion_x
/
2
;
my
=
motion_y
/
2
;
my
=
motion_y
/
2
;
uvdxy
=
((
my
&
1
)
<<
1
)
|
(
mx
&
1
);
uvdxy
=
((
my
&
1
)
<<
1
)
|
(
mx
&
1
);
uvsrc_x
=
s
->
mb_x
*
8
+
(
mx
>>
1
);
uvsrc_x
=
s
->
mb_x
*
8
+
(
mx
>>
1
);
uvsrc_y
=
(
mb_y
<<
(
3
-
field_based
))
+
(
my
>>
1
);
uvsrc_y
=
(
mb_y
<<
(
3
-
field_based
))
+
(
my
>>
1
);
}
else
{
}
else
{
if
(
s
->
chroma_x_shift
)
{
if
(
s
->
chroma_x_shift
)
{
//
Chroma422
//
Chroma422
mx
=
motion_x
/
2
;
mx
=
motion_x
/
2
;
uvdxy
=
((
motion_y
&
1
)
<<
1
)
|
(
mx
&
1
);
uvdxy
=
((
motion_y
&
1
)
<<
1
)
|
(
mx
&
1
);
uvsrc_x
=
s
->
mb_x
*
8
+
(
mx
>>
1
);
uvsrc_x
=
s
->
mb_x
*
8
+
(
mx
>>
1
);
uvsrc_y
=
src_y
;
uvsrc_y
=
src_y
;
}
else
{
}
else
{
//
Chroma444
//
Chroma444
uvdxy
=
dxy
;
uvdxy
=
dxy
;
uvsrc_x
=
src_x
;
uvsrc_x
=
src_x
;
uvsrc_y
=
src_y
;
uvsrc_y
=
src_y
;
}
}
...
@@ -281,58 +310,63 @@ if(s->quarter_sample)
...
@@ -281,58 +310,63 @@ if(s->quarter_sample)
ptr_cb
=
ref_picture
[
1
]
+
uvsrc_y
*
uvlinesize
+
uvsrc_x
;
ptr_cb
=
ref_picture
[
1
]
+
uvsrc_y
*
uvlinesize
+
uvsrc_x
;
ptr_cr
=
ref_picture
[
2
]
+
uvsrc_y
*
uvlinesize
+
uvsrc_x
;
ptr_cr
=
ref_picture
[
2
]
+
uvsrc_y
*
uvlinesize
+
uvsrc_x
;
if
(
(
unsigned
)
src_x
>
FFMAX
(
s
->
h_edge_pos
-
(
motion_x
&
1
)
-
16
,
0
)
if
((
unsigned
)
src_x
>
FFMAX
(
s
->
h_edge_pos
-
(
motion_x
&
1
)
-
16
,
0
)
||
||
(
unsigned
)
src_y
>
FFMAX
(
v_edge_pos
-
(
motion_y
&
1
)
-
h
,
0
)){
(
unsigned
)
src_y
>
FFMAX
(
v_edge_pos
-
(
motion_y
&
1
)
-
h
,
0
))
{
if
(
is_mpeg12
||
s
->
codec_id
==
AV_CODEC_ID_MPEG2VIDEO
||
if
(
is_mpeg12
||
s
->
codec_id
==
AV_CODEC_ID_MPEG1VIDEO
){
s
->
codec_id
==
AV_CODEC_ID_MPEG2VIDEO
||
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
s
->
codec_id
==
AV_CODEC_ID_MPEG1VIDEO
)
{
"MPEG motion vector out of boundary (%d %d)
\n
"
,
src_x
,
src_y
);
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
return
;
"MPEG motion vector out of boundary (%d %d)
\n
"
,
src_x
,
}
src_y
);
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_y
,
s
->
linesize
,
return
;
17
,
17
+
field_based
,
}
src_x
,
src_y
<<
field_based
,
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_y
,
s
->
h_edge_pos
,
s
->
v_edge_pos
);
s
->
linesize
,
ptr_y
=
s
->
edge_emu_buffer
;
17
,
17
+
field_based
,
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
)){
src_x
,
src_y
<<
field_based
,
uint8_t
*
uvbuf
=
s
->
edge_emu_buffer
+
18
*
s
->
linesize
;
s
->
h_edge_pos
,
s
->
v_edge_pos
);
s
->
vdsp
.
emulated_edge_mc
(
uvbuf
,
ptr_y
=
s
->
edge_emu_buffer
;
ptr_cb
,
s
->
uvlinesize
,
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
))
{
9
,
9
+
field_based
,
uint8_t
*
uvbuf
=
s
->
edge_emu_buffer
+
18
*
s
->
linesize
;
uvsrc_x
,
uvsrc_y
<<
field_based
,
s
->
vdsp
.
emulated_edge_mc
(
uvbuf
,
ptr_cb
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
s
->
uvlinesize
,
s
->
vdsp
.
emulated_edge_mc
(
uvbuf
+
16
,
9
,
9
+
field_based
,
ptr_cr
,
s
->
uvlinesize
,
uvsrc_x
,
uvsrc_y
<<
field_based
,
9
,
9
+
field_based
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
uvsrc_x
,
uvsrc_y
<<
field_based
,
s
->
vdsp
.
emulated_edge_mc
(
uvbuf
+
16
,
ptr_cr
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
s
->
uvlinesize
,
ptr_cb
=
uvbuf
;
9
,
9
+
field_based
,
ptr_cr
=
uvbuf
+
16
;
uvsrc_x
,
uvsrc_y
<<
field_based
,
}
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
ptr_cb
=
uvbuf
;
ptr_cr
=
uvbuf
+
16
;
}
}
}
if
(
bottom_field
){
//FIXME use this for field pix too instead of the obnoxious hack which changes picture.data
/* FIXME use this for field pix too instead of the obnoxious hack which
dest_y
+=
s
->
linesize
;
* changes picture.data */
dest_cb
+=
s
->
uvlinesize
;
if
(
bottom_field
)
{
dest_cr
+=
s
->
uvlinesize
;
dest_y
+=
s
->
linesize
;
dest_cb
+=
s
->
uvlinesize
;
dest_cr
+=
s
->
uvlinesize
;
}
}
if
(
field_select
)
{
if
(
field_select
)
{
ptr_y
+=
s
->
linesize
;
ptr_y
+=
s
->
linesize
;
ptr_cb
+=
s
->
uvlinesize
;
ptr_cb
+=
s
->
uvlinesize
;
ptr_cr
+=
s
->
uvlinesize
;
ptr_cr
+=
s
->
uvlinesize
;
}
}
pix_op
[
0
][
dxy
](
dest_y
,
ptr_y
,
linesize
,
h
);
pix_op
[
0
][
dxy
](
dest_y
,
ptr_y
,
linesize
,
h
);
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
))
{
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
))
{
pix_op
[
s
->
chroma_x_shift
][
uvdxy
]
pix_op
[
s
->
chroma_x_shift
][
uvdxy
]
(
dest_cb
,
ptr_cb
,
uvlinesize
,
h
>>
s
->
chroma_y_shift
);
(
dest_cb
,
ptr_cb
,
uvlinesize
,
h
>>
s
->
chroma_y_shift
);
pix_op
[
s
->
chroma_x_shift
][
uvdxy
]
pix_op
[
s
->
chroma_x_shift
][
uvdxy
]
(
dest_cr
,
ptr_cr
,
uvlinesize
,
h
>>
s
->
chroma_y_shift
);
(
dest_cr
,
ptr_cr
,
uvlinesize
,
h
>>
s
->
chroma_y_shift
);
}
}
if
(
!
is_mpeg12
&&
(
CONFIG_H261_ENCODER
||
CONFIG_H261_DECODER
)
&&
if
(
!
is_mpeg12
&&
(
CONFIG_H261_ENCODER
||
CONFIG_H261_DECODER
)
&&
s
->
out_format
==
FMT_H261
)
{
s
->
out_format
==
FMT_H261
)
{
ff_h261_loop_filter
(
s
);
ff_h261_loop_filter
(
s
);
}
}
}
}
...
@@ -344,15 +378,15 @@ static void mpeg_motion(MpegEncContext *s,
...
@@ -344,15 +378,15 @@ static void mpeg_motion(MpegEncContext *s,
int
motion_x
,
int
motion_y
,
int
h
,
int
mb_y
)
int
motion_x
,
int
motion_y
,
int
h
,
int
mb_y
)
{
{
#if !CONFIG_SMALL
#if !CONFIG_SMALL
if
(
s
->
out_format
==
FMT_MPEG1
)
if
(
s
->
out_format
==
FMT_MPEG1
)
mpeg_motion_internal
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
0
,
0
,
mpeg_motion_internal
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
0
,
0
,
field_select
,
ref_picture
,
pix_op
,
field_select
,
ref_picture
,
pix_op
,
motion_x
,
motion_y
,
h
,
1
,
mb_y
);
motion_x
,
motion_y
,
h
,
1
,
mb_y
);
else
else
#endif
#endif
mpeg_motion_internal
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
0
,
0
,
mpeg_motion_internal
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
0
,
0
,
field_select
,
ref_picture
,
pix_op
,
field_select
,
ref_picture
,
pix_op
,
motion_x
,
motion_y
,
h
,
0
,
mb_y
);
motion_x
,
motion_y
,
h
,
0
,
mb_y
);
}
}
static
void
mpeg_motion_field
(
MpegEncContext
*
s
,
uint8_t
*
dest_y
,
static
void
mpeg_motion_field
(
MpegEncContext
*
s
,
uint8_t
*
dest_y
,
...
@@ -365,23 +399,24 @@ static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y,
...
@@ -365,23 +399,24 @@ static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y,
#if !CONFIG_SMALL
#if !CONFIG_SMALL
if
(
s
->
out_format
==
FMT_MPEG1
)
if
(
s
->
out_format
==
FMT_MPEG1
)
mpeg_motion_internal
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
1
,
mpeg_motion_internal
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
1
,
bottom_field
,
field_select
,
ref_picture
,
pix_op
,
bottom_field
,
field_select
,
ref_picture
,
pix_op
,
motion_x
,
motion_y
,
h
,
1
,
mb_y
);
motion_x
,
motion_y
,
h
,
1
,
mb_y
);
else
else
#endif
#endif
mpeg_motion_internal
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
1
,
mpeg_motion_internal
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
1
,
bottom_field
,
field_select
,
ref_picture
,
pix_op
,
bottom_field
,
field_select
,
ref_picture
,
pix_op
,
motion_x
,
motion_y
,
h
,
0
,
mb_y
);
motion_x
,
motion_y
,
h
,
0
,
mb_y
);
}
}
//FIXME move to dsputil, avg variant, 16x16 version
// FIXME move to dsputil, avg variant, 16x16 version
static
inline
void
put_obmc
(
uint8_t
*
dst
,
uint8_t
*
src
[
5
],
int
stride
){
static
inline
void
put_obmc
(
uint8_t
*
dst
,
uint8_t
*
src
[
5
],
int
stride
)
{
int
x
;
int
x
;
uint8_t
*
const
top
=
src
[
1
];
uint8_t
*
const
top
=
src
[
1
];
uint8_t
*
const
left
=
src
[
2
];
uint8_t
*
const
left
=
src
[
2
];
uint8_t
*
const
mid
=
src
[
0
];
uint8_t
*
const
mid
=
src
[
0
];
uint8_t
*
const
right
=
src
[
3
];
uint8_t
*
const
right
=
src
[
3
];
uint8_t
*
const
bottom
=
src
[
4
];
uint8_t
*
const
bottom
=
src
[
4
];
#define OBMC_FILTER(x, t, l, m, r, b)\
#define OBMC_FILTER(x, t, l, m, r, b)\
dst[x]= (t*top[x] + l*left[x] + m*mid[x] + r*right[x] + b*bottom[x] + 4)>>3
dst[x]= (t*top[x] + l*left[x] + m*mid[x] + r*right[x] + b*bottom[x] + 4)>>3
#define OBMC_FILTER4(x, t, l, m, r, b)\
#define OBMC_FILTER4(x, t, l, m, r, b)\
...
@@ -390,40 +425,40 @@ static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride){
...
@@ -390,40 +425,40 @@ static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride){
OBMC_FILTER(x +stride, t, l, m, r, b);\
OBMC_FILTER(x +stride, t, l, m, r, b);\
OBMC_FILTER(x+1+stride, t, l, m, r, b);
OBMC_FILTER(x+1+stride, t, l, m, r, b);
x
=
0
;
x
=
0
;
OBMC_FILTER
(
x
,
2
,
2
,
4
,
0
,
0
);
OBMC_FILTER
(
x
,
2
,
2
,
4
,
0
,
0
);
OBMC_FILTER
(
x
+
1
,
2
,
1
,
5
,
0
,
0
);
OBMC_FILTER
(
x
+
1
,
2
,
1
,
5
,
0
,
0
);
OBMC_FILTER4
(
x
+
2
,
2
,
1
,
5
,
0
,
0
);
OBMC_FILTER4
(
x
+
2
,
2
,
1
,
5
,
0
,
0
);
OBMC_FILTER4
(
x
+
4
,
2
,
0
,
5
,
1
,
0
);
OBMC_FILTER4
(
x
+
4
,
2
,
0
,
5
,
1
,
0
);
OBMC_FILTER
(
x
+
6
,
2
,
0
,
5
,
1
,
0
);
OBMC_FILTER
(
x
+
6
,
2
,
0
,
5
,
1
,
0
);
OBMC_FILTER
(
x
+
7
,
2
,
0
,
4
,
2
,
0
);
OBMC_FILTER
(
x
+
7
,
2
,
0
,
4
,
2
,
0
);
x
+=
stride
;
x
+=
stride
;
OBMC_FILTER
(
x
,
1
,
2
,
5
,
0
,
0
);
OBMC_FILTER
(
x
,
1
,
2
,
5
,
0
,
0
);
OBMC_FILTER
(
x
+
1
,
1
,
2
,
5
,
0
,
0
);
OBMC_FILTER
(
x
+
1
,
1
,
2
,
5
,
0
,
0
);
OBMC_FILTER
(
x
+
6
,
1
,
0
,
5
,
2
,
0
);
OBMC_FILTER
(
x
+
6
,
1
,
0
,
5
,
2
,
0
);
OBMC_FILTER
(
x
+
7
,
1
,
0
,
5
,
2
,
0
);
OBMC_FILTER
(
x
+
7
,
1
,
0
,
5
,
2
,
0
);
x
+=
stride
;
x
+=
stride
;
OBMC_FILTER4
(
x
,
1
,
2
,
5
,
0
,
0
);
OBMC_FILTER4
(
x
,
1
,
2
,
5
,
0
,
0
);
OBMC_FILTER4
(
x
+
2
,
1
,
1
,
6
,
0
,
0
);
OBMC_FILTER4
(
x
+
2
,
1
,
1
,
6
,
0
,
0
);
OBMC_FILTER4
(
x
+
4
,
1
,
0
,
6
,
1
,
0
);
OBMC_FILTER4
(
x
+
4
,
1
,
0
,
6
,
1
,
0
);
OBMC_FILTER4
(
x
+
6
,
1
,
0
,
5
,
2
,
0
);
OBMC_FILTER4
(
x
+
6
,
1
,
0
,
5
,
2
,
0
);
x
+=
2
*
stride
;
x
+=
2
*
stride
;
OBMC_FILTER4
(
x
,
0
,
2
,
5
,
0
,
1
);
OBMC_FILTER4
(
x
,
0
,
2
,
5
,
0
,
1
);
OBMC_FILTER4
(
x
+
2
,
0
,
1
,
6
,
0
,
1
);
OBMC_FILTER4
(
x
+
2
,
0
,
1
,
6
,
0
,
1
);
OBMC_FILTER4
(
x
+
4
,
0
,
0
,
6
,
1
,
1
);
OBMC_FILTER4
(
x
+
4
,
0
,
0
,
6
,
1
,
1
);
OBMC_FILTER4
(
x
+
6
,
0
,
0
,
5
,
2
,
1
);
OBMC_FILTER4
(
x
+
6
,
0
,
0
,
5
,
2
,
1
);
x
+=
2
*
stride
;
x
+=
2
*
stride
;
OBMC_FILTER
(
x
,
0
,
2
,
5
,
0
,
1
);
OBMC_FILTER
(
x
,
0
,
2
,
5
,
0
,
1
);
OBMC_FILTER
(
x
+
1
,
0
,
2
,
5
,
0
,
1
);
OBMC_FILTER
(
x
+
1
,
0
,
2
,
5
,
0
,
1
);
OBMC_FILTER4
(
x
+
2
,
0
,
1
,
5
,
0
,
2
);
OBMC_FILTER4
(
x
+
2
,
0
,
1
,
5
,
0
,
2
);
OBMC_FILTER4
(
x
+
4
,
0
,
0
,
5
,
1
,
2
);
OBMC_FILTER4
(
x
+
4
,
0
,
0
,
5
,
1
,
2
);
OBMC_FILTER
(
x
+
6
,
0
,
0
,
5
,
2
,
1
);
OBMC_FILTER
(
x
+
6
,
0
,
0
,
5
,
2
,
1
);
OBMC_FILTER
(
x
+
7
,
0
,
0
,
5
,
2
,
1
);
OBMC_FILTER
(
x
+
7
,
0
,
0
,
5
,
2
,
1
);
x
+=
stride
;
x
+=
stride
;
OBMC_FILTER
(
x
,
0
,
2
,
4
,
0
,
2
);
OBMC_FILTER
(
x
,
0
,
2
,
4
,
0
,
2
);
OBMC_FILTER
(
x
+
1
,
0
,
1
,
5
,
0
,
2
);
OBMC_FILTER
(
x
+
1
,
0
,
1
,
5
,
0
,
2
);
OBMC_FILTER
(
x
+
6
,
0
,
0
,
5
,
1
,
2
);
OBMC_FILTER
(
x
+
6
,
0
,
0
,
5
,
1
,
2
);
OBMC_FILTER
(
x
+
7
,
0
,
0
,
4
,
2
,
2
);
OBMC_FILTER
(
x
+
7
,
0
,
0
,
4
,
2
,
2
);
}
}
/* obmc for 1 8x8 luma block */
/* obmc for 1 8x8 luma block */
...
@@ -431,22 +466,21 @@ static inline void obmc_motion(MpegEncContext *s,
...
@@ -431,22 +466,21 @@ static inline void obmc_motion(MpegEncContext *s,
uint8_t
*
dest
,
uint8_t
*
src
,
uint8_t
*
dest
,
uint8_t
*
src
,
int
src_x
,
int
src_y
,
int
src_x
,
int
src_y
,
op_pixels_func
*
pix_op
,
op_pixels_func
*
pix_op
,
int16_t
mv
[
5
][
2
]
/* mid top left right bottom
*/
)
int16_t
mv
[
5
][
2
]
/* mid top left right bottom
*/
)
#define MID 0
#define MID 0
{
{
int
i
;
int
i
;
uint8_t
*
ptr
[
5
];
uint8_t
*
ptr
[
5
];
assert
(
s
->
quarter_sample
==
0
);
assert
(
s
->
quarter_sample
==
0
);
for
(
i
=
0
;
i
<
5
;
i
++
){
for
(
i
=
0
;
i
<
5
;
i
++
)
{
if
(
i
&&
mv
[
i
][
0
]
==
mv
[
MID
][
0
]
&&
mv
[
i
][
1
]
==
mv
[
MID
][
1
]){
if
(
i
&&
mv
[
i
][
0
]
==
mv
[
MID
][
0
]
&&
mv
[
i
][
1
]
==
mv
[
MID
][
1
])
{
ptr
[
i
]
=
ptr
[
MID
];
ptr
[
i
]
=
ptr
[
MID
];
}
else
{
}
else
{
ptr
[
i
]
=
s
->
obmc_scratchpad
+
8
*
(
i
&
1
)
+
s
->
linesize
*
8
*
(
i
>>
1
);
ptr
[
i
]
=
s
->
obmc_scratchpad
+
8
*
(
i
&
1
)
+
hpel_motion
(
s
,
ptr
[
i
],
src
,
s
->
linesize
*
8
*
(
i
>>
1
);
src_x
,
src_y
,
hpel_motion
(
s
,
ptr
[
i
],
src
,
src_x
,
src_y
,
pix_op
,
pix_op
,
mv
[
i
][
0
],
mv
[
i
][
1
]);
mv
[
i
][
0
],
mv
[
i
][
1
]);
}
}
}
}
...
@@ -455,9 +489,12 @@ static inline void obmc_motion(MpegEncContext *s,
...
@@ -455,9 +489,12 @@ static inline void obmc_motion(MpegEncContext *s,
}
}
static
inline
void
qpel_motion
(
MpegEncContext
*
s
,
static
inline
void
qpel_motion
(
MpegEncContext
*
s
,
uint8_t
*
dest_y
,
uint8_t
*
dest_cb
,
uint8_t
*
dest_cr
,
uint8_t
*
dest_y
,
int
field_based
,
int
bottom_field
,
int
field_select
,
uint8_t
*
dest_cb
,
uint8_t
**
ref_picture
,
op_pixels_func
(
*
pix_op
)[
4
],
uint8_t
*
dest_cr
,
int
field_based
,
int
bottom_field
,
int
field_select
,
uint8_t
**
ref_picture
,
op_pixels_func
(
*
pix_op
)[
4
],
qpel_mc_func
(
*
qpix_op
)[
16
],
qpel_mc_func
(
*
qpix_op
)[
16
],
int
motion_x
,
int
motion_y
,
int
h
)
int
motion_x
,
int
motion_y
,
int
h
)
{
{
...
@@ -465,83 +502,88 @@ static inline void qpel_motion(MpegEncContext *s,
...
@@ -465,83 +502,88 @@ static inline void qpel_motion(MpegEncContext *s,
int
dxy
,
uvdxy
,
mx
,
my
,
src_x
,
src_y
,
uvsrc_x
,
uvsrc_y
,
v_edge_pos
;
int
dxy
,
uvdxy
,
mx
,
my
,
src_x
,
src_y
,
uvsrc_x
,
uvsrc_y
,
v_edge_pos
;
ptrdiff_t
linesize
,
uvlinesize
;
ptrdiff_t
linesize
,
uvlinesize
;
dxy
=
((
motion_y
&
3
)
<<
2
)
|
(
motion_x
&
3
);
dxy
=
((
motion_y
&
3
)
<<
2
)
|
(
motion_x
&
3
);
src_x
=
s
->
mb_x
*
16
+
(
motion_x
>>
2
);
src_x
=
s
->
mb_x
*
16
+
(
motion_x
>>
2
);
src_y
=
s
->
mb_y
*
(
16
>>
field_based
)
+
(
motion_y
>>
2
);
src_y
=
s
->
mb_y
*
(
16
>>
field_based
)
+
(
motion_y
>>
2
);
v_edge_pos
=
s
->
v_edge_pos
>>
field_based
;
v_edge_pos
=
s
->
v_edge_pos
>>
field_based
;
linesize
=
s
->
linesize
<<
field_based
;
linesize
=
s
->
linesize
<<
field_based
;
uvlinesize
=
s
->
uvlinesize
<<
field_based
;
uvlinesize
=
s
->
uvlinesize
<<
field_based
;
if
(
field_based
)
{
if
(
field_based
)
{
mx
=
motion_x
/
2
;
mx
=
motion_x
/
2
;
my
=
motion_y
>>
1
;
my
=
motion_y
>>
1
;
}
else
if
(
s
->
workaround_bugs
&
FF_BUG_QPEL_CHROMA2
)
{
}
else
if
(
s
->
workaround_bugs
&
FF_BUG_QPEL_CHROMA2
)
{
static
const
int
rtab
[
8
]
=
{
0
,
0
,
1
,
1
,
0
,
0
,
0
,
1
};
static
const
int
rtab
[
8
]
=
{
0
,
0
,
1
,
1
,
0
,
0
,
0
,
1
};
mx
=
(
motion_x
>>
1
)
+
rtab
[
motion_x
&
7
];
mx
=
(
motion_x
>>
1
)
+
rtab
[
motion_x
&
7
];
my
=
(
motion_y
>>
1
)
+
rtab
[
motion_y
&
7
];
my
=
(
motion_y
>>
1
)
+
rtab
[
motion_y
&
7
];
}
else
if
(
s
->
workaround_bugs
&
FF_BUG_QPEL_CHROMA
)
{
}
else
if
(
s
->
workaround_bugs
&
FF_BUG_QPEL_CHROMA
)
{
mx
=
(
motion_x
>>
1
)
|
(
motion_x
&
1
);
mx
=
(
motion_x
>>
1
)
|
(
motion_x
&
1
);
my
=
(
motion_y
>>
1
)
|
(
motion_y
&
1
);
my
=
(
motion_y
>>
1
)
|
(
motion_y
&
1
);
}
else
{
}
else
{
mx
=
motion_x
/
2
;
mx
=
motion_x
/
2
;
my
=
motion_y
/
2
;
my
=
motion_y
/
2
;
}
}
mx
=
(
mx
>>
1
)
|
(
mx
&
1
);
mx
=
(
mx
>>
1
)
|
(
mx
&
1
);
my
=
(
my
>>
1
)
|
(
my
&
1
);
my
=
(
my
>>
1
)
|
(
my
&
1
);
uvdxy
=
(
mx
&
1
)
|
((
my
&
1
)
<<
1
);
uvdxy
=
(
mx
&
1
)
|
((
my
&
1
)
<<
1
);
mx
>>=
1
;
mx
>>=
1
;
my
>>=
1
;
my
>>=
1
;
uvsrc_x
=
s
->
mb_x
*
8
+
mx
;
uvsrc_x
=
s
->
mb_x
*
8
+
mx
;
uvsrc_y
=
s
->
mb_y
*
(
8
>>
field_based
)
+
my
;
uvsrc_y
=
s
->
mb_y
*
(
8
>>
field_based
)
+
my
;
ptr_y
=
ref_picture
[
0
]
+
src_y
*
linesize
+
src_x
;
ptr_y
=
ref_picture
[
0
]
+
src_y
*
linesize
+
src_x
;
ptr_cb
=
ref_picture
[
1
]
+
uvsrc_y
*
uvlinesize
+
uvsrc_x
;
ptr_cb
=
ref_picture
[
1
]
+
uvsrc_y
*
uvlinesize
+
uvsrc_x
;
ptr_cr
=
ref_picture
[
2
]
+
uvsrc_y
*
uvlinesize
+
uvsrc_x
;
ptr_cr
=
ref_picture
[
2
]
+
uvsrc_y
*
uvlinesize
+
uvsrc_x
;
if
(
(
unsigned
)
src_x
>
FFMAX
(
s
->
h_edge_pos
-
(
motion_x
&
3
)
-
16
,
0
)
if
((
unsigned
)
src_x
>
FFMAX
(
s
->
h_edge_pos
-
(
motion_x
&
3
)
-
16
,
0
)
||
||
(
unsigned
)
src_y
>
FFMAX
(
v_edge_pos
-
(
motion_y
&
3
)
-
h
,
0
)){
(
unsigned
)
src_y
>
FFMAX
(
v_edge_pos
-
(
motion_y
&
3
)
-
h
,
0
))
{
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_y
,
s
->
linesize
,
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_y
,
17
,
17
+
field_based
,
src_x
,
src_y
<<
field_based
,
s
->
linesize
,
s
->
h_edge_pos
,
s
->
v_edge_pos
);
17
,
17
+
field_based
,
ptr_y
=
s
->
edge_emu_buffer
;
src_x
,
src_y
<<
field_based
,
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
)){
s
->
h_edge_pos
,
s
->
v_edge_pos
);
uint8_t
*
uvbuf
=
s
->
edge_emu_buffer
+
18
*
s
->
linesize
;
ptr_y
=
s
->
edge_emu_buffer
;
s
->
vdsp
.
emulated_edge_mc
(
uvbuf
,
ptr_cb
,
s
->
uvlinesize
,
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
))
{
9
,
9
+
field_based
,
uint8_t
*
uvbuf
=
s
->
edge_emu_buffer
+
18
*
s
->
linesize
;
uvsrc_x
,
uvsrc_y
<<
field_based
,
s
->
vdsp
.
emulated_edge_mc
(
uvbuf
,
ptr_cb
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
s
->
uvlinesize
,
s
->
vdsp
.
emulated_edge_mc
(
uvbuf
+
16
,
ptr_cr
,
s
->
uvlinesize
,
9
,
9
+
field_based
,
9
,
9
+
field_based
,
uvsrc_x
,
uvsrc_y
<<
field_based
,
uvsrc_x
,
uvsrc_y
<<
field_based
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
s
->
vdsp
.
emulated_edge_mc
(
uvbuf
+
16
,
ptr_cr
,
ptr_cb
=
uvbuf
;
s
->
uvlinesize
,
ptr_cr
=
uvbuf
+
16
;
9
,
9
+
field_based
,
uvsrc_x
,
uvsrc_y
<<
field_based
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
ptr_cb
=
uvbuf
;
ptr_cr
=
uvbuf
+
16
;
}
}
}
}
if
(
!
field_based
)
if
(
!
field_based
)
qpix_op
[
0
][
dxy
](
dest_y
,
ptr_y
,
linesize
);
qpix_op
[
0
][
dxy
](
dest_y
,
ptr_y
,
linesize
);
else
{
else
{
if
(
bottom_field
)
{
if
(
bottom_field
)
{
dest_y
+=
s
->
linesize
;
dest_y
+=
s
->
linesize
;
dest_cb
+=
s
->
uvlinesize
;
dest_cb
+=
s
->
uvlinesize
;
dest_cr
+=
s
->
uvlinesize
;
dest_cr
+=
s
->
uvlinesize
;
}
}
if
(
field_select
)
{
if
(
field_select
)
{
ptr_y
+=
s
->
linesize
;
ptr_y
+=
s
->
linesize
;
ptr_cb
+=
s
->
uvlinesize
;
ptr_cb
+=
s
->
uvlinesize
;
ptr_cr
+=
s
->
uvlinesize
;
ptr_cr
+=
s
->
uvlinesize
;
}
}
//damn interlaced mode
//
damn interlaced mode
//FIXME boundary mirroring is not exactly correct here
//
FIXME boundary mirroring is not exactly correct here
qpix_op
[
1
][
dxy
](
dest_y
,
ptr_y
,
linesize
);
qpix_op
[
1
][
dxy
](
dest_y
,
ptr_y
,
linesize
);
qpix_op
[
1
][
dxy
](
dest_y
+
8
,
ptr_y
+
8
,
linesize
);
qpix_op
[
1
][
dxy
](
dest_y
+
8
,
ptr_y
+
8
,
linesize
);
}
}
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
))
{
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
))
{
pix_op
[
1
][
uvdxy
](
dest_cr
,
ptr_cr
,
uvlinesize
,
h
>>
1
);
pix_op
[
1
][
uvdxy
](
dest_cr
,
ptr_cr
,
uvlinesize
,
h
>>
1
);
pix_op
[
1
][
uvdxy
](
dest_cb
,
ptr_cb
,
uvlinesize
,
h
>>
1
);
pix_op
[
1
][
uvdxy
](
dest_cb
,
ptr_cb
,
uvlinesize
,
h
>>
1
);
}
}
...
@@ -561,11 +603,11 @@ static void chroma_4mv_motion(MpegEncContext *s,
...
@@ -561,11 +603,11 @@ static void chroma_4mv_motion(MpegEncContext *s,
ptrdiff_t
offset
;
ptrdiff_t
offset
;
/* In case of 8X8, we construct a single chroma motion vector
/* In case of 8X8, we construct a single chroma motion vector
with a special rounding */
*
with a special rounding */
mx
=
ff_h263_round_chroma
(
mx
);
mx
=
ff_h263_round_chroma
(
mx
);
my
=
ff_h263_round_chroma
(
my
);
my
=
ff_h263_round_chroma
(
my
);
dxy
=
((
my
&
1
)
<<
1
)
|
(
mx
&
1
);
dxy
=
((
my
&
1
)
<<
1
)
|
(
mx
&
1
);
mx
>>=
1
;
mx
>>=
1
;
my
>>=
1
;
my
>>=
1
;
...
@@ -579,39 +621,43 @@ static void chroma_4mv_motion(MpegEncContext *s,
...
@@ -579,39 +621,43 @@ static void chroma_4mv_motion(MpegEncContext *s,
dxy
&=
~
2
;
dxy
&=
~
2
;
offset
=
src_y
*
s
->
uvlinesize
+
src_x
;
offset
=
src_y
*
s
->
uvlinesize
+
src_x
;
ptr
=
ref_picture
[
1
]
+
offset
;
ptr
=
ref_picture
[
1
]
+
offset
;
if
(
s
->
flags
&
CODEC_FLAG_EMU_EDGE
){
if
(
s
->
flags
&
CODEC_FLAG_EMU_EDGE
)
{
if
(
(
unsigned
)
src_x
>
FFMAX
((
s
->
h_edge_pos
>>
1
)
-
(
dxy
&
1
)
-
8
,
0
)
if
((
unsigned
)
src_x
>
FFMAX
((
s
->
h_edge_pos
>>
1
)
-
(
dxy
&
1
)
-
8
,
0
)
||
||
(
unsigned
)
src_y
>
FFMAX
((
s
->
v_edge_pos
>>
1
)
-
(
dxy
>>
1
)
-
8
,
0
)){
(
unsigned
)
src_y
>
FFMAX
((
s
->
v_edge_pos
>>
1
)
-
(
dxy
>>
1
)
-
8
,
0
))
{
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr
,
s
->
uvlinesize
,
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
9
,
9
,
src_x
,
src_y
,
ptr
,
s
->
uvlinesize
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
9
,
9
,
src_x
,
src_y
,
ptr
=
s
->
edge_emu_buffer
;
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
emu
=
1
;
ptr
=
s
->
edge_emu_buffer
;
emu
=
1
;
}
}
}
}
pix_op
[
dxy
](
dest_cb
,
ptr
,
s
->
uvlinesize
,
8
);
pix_op
[
dxy
](
dest_cb
,
ptr
,
s
->
uvlinesize
,
8
);
ptr
=
ref_picture
[
2
]
+
offset
;
ptr
=
ref_picture
[
2
]
+
offset
;
if
(
emu
){
if
(
emu
)
{
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr
,
s
->
uvlinesize
,
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
9
,
9
,
src_x
,
src_y
,
ptr
,
s
->
uvlinesize
,
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
9
,
9
,
src_x
,
src_y
,
ptr
=
s
->
edge_emu_buffer
;
s
->
h_edge_pos
>>
1
,
s
->
v_edge_pos
>>
1
);
ptr
=
s
->
edge_emu_buffer
;
}
}
pix_op
[
dxy
](
dest_cr
,
ptr
,
s
->
uvlinesize
,
8
);
pix_op
[
dxy
](
dest_cr
,
ptr
,
s
->
uvlinesize
,
8
);
}
}
static
inline
void
prefetch_motion
(
MpegEncContext
*
s
,
uint8_t
**
pix
,
int
dir
){
static
inline
void
prefetch_motion
(
MpegEncContext
*
s
,
uint8_t
**
pix
,
int
dir
)
{
/* fetch pixels for estimated mv 4 macroblocks ahead
/* fetch pixels for estimated mv 4 macroblocks ahead
* optimized for 64byte cache lines */
* optimized for 64byte cache lines */
const
int
shift
=
s
->
quarter_sample
?
2
:
1
;
const
int
shift
=
s
->
quarter_sample
?
2
:
1
;
const
int
mx
=
(
s
->
mv
[
dir
][
0
][
0
]
>>
shift
)
+
16
*
s
->
mb_x
+
8
;
const
int
mx
=
(
s
->
mv
[
dir
][
0
][
0
]
>>
shift
)
+
16
*
s
->
mb_x
+
8
;
const
int
my
=
(
s
->
mv
[
dir
][
0
][
1
]
>>
shift
)
+
16
*
s
->
mb_y
;
const
int
my
=
(
s
->
mv
[
dir
][
0
][
1
]
>>
shift
)
+
16
*
s
->
mb_y
;
int
off
=
mx
+
(
my
+
(
s
->
mb_x
&
3
)
*
4
)
*
s
->
linesize
+
64
;
int
off
=
mx
+
(
my
+
(
s
->
mb_x
&
3
)
*
4
)
*
s
->
linesize
+
64
;
s
->
vdsp
.
prefetch
(
pix
[
0
]
+
off
,
s
->
linesize
,
4
);
off
=
(
mx
>>
1
)
+
((
my
>>
1
)
+
(
s
->
mb_x
&
7
))
*
s
->
uvlinesize
+
64
;
s
->
vdsp
.
prefetch
(
pix
[
0
]
+
off
,
s
->
linesize
,
4
);
s
->
vdsp
.
prefetch
(
pix
[
1
]
+
off
,
pix
[
2
]
-
pix
[
1
],
2
);
off
=
(
mx
>>
1
)
+
((
my
>>
1
)
+
(
s
->
mb_x
&
7
))
*
s
->
uvlinesize
+
64
;
s
->
vdsp
.
prefetch
(
pix
[
1
]
+
off
,
pix
[
2
]
-
pix
[
1
],
2
);
}
}
/**
/**
...
@@ -627,11 +673,14 @@ static inline void prefetch_motion(MpegEncContext *s, uint8_t **pix, int dir){
...
@@ -627,11 +673,14 @@ static inline void prefetch_motion(MpegEncContext *s, uint8_t **pix, int dir){
* the motion vectors are taken from s->mv and the MV type from s->mv_type
* the motion vectors are taken from s->mv and the MV type from s->mv_type
*/
*/
static
av_always_inline
void
MPV_motion_internal
(
MpegEncContext
*
s
,
static
av_always_inline
void
MPV_motion_internal
(
MpegEncContext
*
s
,
uint8_t
*
dest_y
,
uint8_t
*
dest_cb
,
uint8_t
*
dest_y
,
uint8_t
*
dest_cr
,
int
dir
,
uint8_t
*
dest_cb
,
uint8_t
**
ref_picture
,
uint8_t
*
dest_cr
,
op_pixels_func
(
*
pix_op
)[
4
],
int
dir
,
qpel_mc_func
(
*
qpix_op
)[
16
],
int
is_mpeg12
)
uint8_t
**
ref_picture
,
op_pixels_func
(
*
pix_op
)[
4
],
qpel_mc_func
(
*
qpix_op
)[
16
],
int
is_mpeg12
)
{
{
int
dxy
,
mx
,
my
,
src_x
,
src_y
,
motion_x
,
motion_y
;
int
dxy
,
mx
,
my
,
src_x
,
src_y
,
motion_x
,
motion_y
;
int
mb_x
,
mb_y
,
i
;
int
mb_x
,
mb_y
,
i
;
...
@@ -642,86 +691,97 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
...
@@ -642,86 +691,97 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
prefetch_motion
(
s
,
ref_picture
,
dir
);
prefetch_motion
(
s
,
ref_picture
,
dir
);
if
(
!
is_mpeg12
&&
s
->
obmc
&&
s
->
pict_type
!=
AV_PICTURE_TYPE_B
)
{
if
(
!
is_mpeg12
&&
s
->
obmc
&&
s
->
pict_type
!=
AV_PICTURE_TYPE_B
)
{
LOCAL_ALIGNED_8
(
int16_t
,
mv_cache
,
[
4
],
[
4
][
2
]);
LOCAL_ALIGNED_8
(
int16_t
,
mv_cache
,
[
4
],
[
4
][
2
]);
Picture
*
cur_frame
=
&
s
->
current_picture
;
Picture
*
cur_frame
=
&
s
->
current_picture
;
const
int
xy
=
s
->
mb_x
+
s
->
mb_y
*
s
->
mb_stride
;
const
int
xy
=
s
->
mb_x
+
s
->
mb_y
*
s
->
mb_stride
;
const
int
mot_stride
=
s
->
b8_stride
;
const
int
mot_stride
=
s
->
b8_stride
;
const
int
mot_xy
=
mb_x
*
2
+
mb_y
*
2
*
mot_stride
;
const
int
mot_xy
=
mb_x
*
2
+
mb_y
*
2
*
mot_stride
;
assert
(
!
s
->
mb_skipped
);
assert
(
!
s
->
mb_skipped
);
AV_COPY32
(
mv_cache
[
1
][
1
],
cur_frame
->
motion_val
[
0
][
mot_xy
]);
AV_COPY32
(
mv_cache
[
1
][
1
],
cur_frame
->
motion_val
[
0
][
mot_xy
]);
AV_COPY32
(
mv_cache
[
1
][
2
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
1
]);
AV_COPY32
(
mv_cache
[
1
][
2
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
1
]);
AV_COPY32
(
mv_cache
[
2
][
1
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
mot_stride
]);
AV_COPY32
(
mv_cache
[
2
][
1
],
AV_COPY32
(
mv_cache
[
2
][
2
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
mot_stride
+
1
]);
cur_frame
->
motion_val
[
0
][
mot_xy
+
mot_stride
]);
AV_COPY32
(
mv_cache
[
2
][
2
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
mot_stride
+
1
]);
AV_COPY32
(
mv_cache
[
3
][
1
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
mot_stride
]);
AV_COPY32
(
mv_cache
[
3
][
1
],
AV_COPY32
(
mv_cache
[
3
][
2
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
mot_stride
+
1
]);
cur_frame
->
motion_val
[
0
][
mot_xy
+
mot_stride
]);
AV_COPY32
(
mv_cache
[
3
][
2
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
mot_stride
+
1
]);
if
(
mb_y
==
0
||
IS_INTRA
(
cur_frame
->
mb_type
[
xy
-
s
->
mb_stride
]))
{
if
(
mb_y
==
0
||
IS_INTRA
(
cur_frame
->
mb_type
[
xy
-
s
->
mb_stride
]))
{
AV_COPY32
(
mv_cache
[
0
][
1
],
mv_cache
[
1
][
1
]);
AV_COPY32
(
mv_cache
[
0
][
1
],
mv_cache
[
1
][
1
]);
AV_COPY32
(
mv_cache
[
0
][
2
],
mv_cache
[
1
][
2
]);
AV_COPY32
(
mv_cache
[
0
][
2
],
mv_cache
[
1
][
2
]);
}
else
{
}
else
{
AV_COPY32
(
mv_cache
[
0
][
1
],
cur_frame
->
motion_val
[
0
][
mot_xy
-
mot_stride
]);
AV_COPY32
(
mv_cache
[
0
][
1
],
AV_COPY32
(
mv_cache
[
0
][
2
],
cur_frame
->
motion_val
[
0
][
mot_xy
-
mot_stride
+
1
]);
cur_frame
->
motion_val
[
0
][
mot_xy
-
mot_stride
]);
AV_COPY32
(
mv_cache
[
0
][
2
],
cur_frame
->
motion_val
[
0
][
mot_xy
-
mot_stride
+
1
]);
}
}
if
(
mb_x
==
0
||
IS_INTRA
(
cur_frame
->
mb_type
[
xy
-
1
]))
{
if
(
mb_x
==
0
||
IS_INTRA
(
cur_frame
->
mb_type
[
xy
-
1
]))
{
AV_COPY32
(
mv_cache
[
1
][
0
],
mv_cache
[
1
][
1
]);
AV_COPY32
(
mv_cache
[
1
][
0
],
mv_cache
[
1
][
1
]);
AV_COPY32
(
mv_cache
[
2
][
0
],
mv_cache
[
2
][
1
]);
AV_COPY32
(
mv_cache
[
2
][
0
],
mv_cache
[
2
][
1
]);
}
else
{
}
else
{
AV_COPY32
(
mv_cache
[
1
][
0
],
cur_frame
->
motion_val
[
0
][
mot_xy
-
1
]);
AV_COPY32
(
mv_cache
[
1
][
0
],
cur_frame
->
motion_val
[
0
][
mot_xy
-
1
]);
AV_COPY32
(
mv_cache
[
2
][
0
],
cur_frame
->
motion_val
[
0
][
mot_xy
-
1
+
mot_stride
]);
AV_COPY32
(
mv_cache
[
2
][
0
],
cur_frame
->
motion_val
[
0
][
mot_xy
-
1
+
mot_stride
]);
}
}
if
(
mb_x
+
1
>=
s
->
mb_width
||
IS_INTRA
(
cur_frame
->
mb_type
[
xy
+
1
]))
{
if
(
mb_x
+
1
>=
s
->
mb_width
||
IS_INTRA
(
cur_frame
->
mb_type
[
xy
+
1
]))
{
AV_COPY32
(
mv_cache
[
1
][
3
],
mv_cache
[
1
][
2
]);
AV_COPY32
(
mv_cache
[
1
][
3
],
mv_cache
[
1
][
2
]);
AV_COPY32
(
mv_cache
[
2
][
3
],
mv_cache
[
2
][
2
]);
AV_COPY32
(
mv_cache
[
2
][
3
],
mv_cache
[
2
][
2
]);
}
else
{
}
else
{
AV_COPY32
(
mv_cache
[
1
][
3
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
2
]);
AV_COPY32
(
mv_cache
[
1
][
3
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
2
]);
AV_COPY32
(
mv_cache
[
2
][
3
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
2
+
mot_stride
]);
AV_COPY32
(
mv_cache
[
2
][
3
],
cur_frame
->
motion_val
[
0
][
mot_xy
+
2
+
mot_stride
]);
}
}
mx
=
0
;
mx
=
0
;
my
=
0
;
my
=
0
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
const
int
x
=
(
i
&
1
)
+
1
;
const
int
x
=
(
i
&
1
)
+
1
;
const
int
y
=
(
i
>>
1
)
+
1
;
const
int
y
=
(
i
>>
1
)
+
1
;
int16_t
mv
[
5
][
2
]
=
{
int16_t
mv
[
5
][
2
]
=
{
{
mv_cache
[
y
][
x
][
0
],
mv_cache
[
y
][
x
][
1
]},
{
mv_cache
[
y
][
x
][
0
],
mv_cache
[
y
][
x
][
1
]
},
{
mv_cache
[
y
-
1
][
x
][
0
],
mv_cache
[
y
-
1
][
x
][
1
]},
{
mv_cache
[
y
-
1
][
x
][
0
],
mv_cache
[
y
-
1
][
x
][
1
]
},
{
mv_cache
[
y
][
x
-
1
][
0
],
mv_cache
[
y
][
x
-
1
][
1
]},
{
mv_cache
[
y
][
x
-
1
][
0
],
mv_cache
[
y
][
x
-
1
][
1
]
},
{
mv_cache
[
y
][
x
+
1
][
0
],
mv_cache
[
y
][
x
+
1
][
1
]},
{
mv_cache
[
y
][
x
+
1
][
0
],
mv_cache
[
y
][
x
+
1
][
1
]
},
{
mv_cache
[
y
+
1
][
x
][
0
],
mv_cache
[
y
+
1
][
x
][
1
]}};
{
mv_cache
[
y
+
1
][
x
][
0
],
mv_cache
[
y
+
1
][
x
][
1
]
}
//FIXME cleanup
};
// FIXME cleanup
obmc_motion
(
s
,
dest_y
+
((
i
&
1
)
*
8
)
+
(
i
>>
1
)
*
8
*
s
->
linesize
,
obmc_motion
(
s
,
dest_y
+
((
i
&
1
)
*
8
)
+
(
i
>>
1
)
*
8
*
s
->
linesize
,
ref_picture
[
0
],
ref_picture
[
0
],
mb_x
*
16
+
(
i
&
1
)
*
8
,
mb_y
*
16
+
(
i
>>
1
)
*
8
,
mb_x
*
16
+
(
i
&
1
)
*
8
,
mb_y
*
16
+
(
i
>>
1
)
*
8
,
pix_op
[
1
],
pix_op
[
1
],
mv
);
mv
);
mx
+=
mv
[
0
][
0
];
mx
+=
mv
[
0
][
0
];
my
+=
mv
[
0
][
1
];
my
+=
mv
[
0
][
1
];
}
}
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
))
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
))
chroma_4mv_motion
(
s
,
dest_cb
,
dest_cr
,
ref_picture
,
pix_op
[
1
],
mx
,
my
);
chroma_4mv_motion
(
s
,
dest_cb
,
dest_cr
,
ref_picture
,
pix_op
[
1
],
mx
,
my
);
return
;
return
;
}
}
switch
(
s
->
mv_type
)
{
switch
(
s
->
mv_type
)
{
case
MV_TYPE_16X16
:
case
MV_TYPE_16X16
:
if
(
s
->
mcsel
)
{
if
(
s
->
mcsel
)
{
if
(
s
->
real_sprite_warping_points
==
1
)
{
if
(
s
->
real_sprite_warping_points
==
1
)
{
gmc1_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
gmc1_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
ref_picture
);
ref_picture
);
}
else
{
}
else
{
gmc_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
gmc_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
ref_picture
);
ref_picture
);
}
}
}
else
if
(
!
is_mpeg12
&&
s
->
quarter_sample
)
{
}
else
if
(
!
is_mpeg12
&&
s
->
quarter_sample
)
{
qpel_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
qpel_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
0
,
0
,
0
,
0
,
0
,
0
,
ref_picture
,
pix_op
,
qpix_op
,
ref_picture
,
pix_op
,
qpix_op
,
...
@@ -729,80 +789,84 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
...
@@ -729,80 +789,84 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
}
else
if
(
!
is_mpeg12
&&
(
CONFIG_WMV2_DECODER
||
CONFIG_WMV2_ENCODER
)
&&
}
else
if
(
!
is_mpeg12
&&
(
CONFIG_WMV2_DECODER
||
CONFIG_WMV2_ENCODER
)
&&
s
->
mspel
&&
s
->
codec_id
==
AV_CODEC_ID_WMV2
)
{
s
->
mspel
&&
s
->
codec_id
==
AV_CODEC_ID_WMV2
)
{
ff_mspel_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
ff_mspel_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
ref_picture
,
pix_op
,
ref_picture
,
pix_op
,
s
->
mv
[
dir
][
0
][
0
],
s
->
mv
[
dir
][
0
][
1
],
16
);
s
->
mv
[
dir
][
0
][
0
],
s
->
mv
[
dir
][
0
][
1
],
16
);
}
else
}
else
{
{
mpeg_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
0
,
mpeg_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
0
,
ref_picture
,
pix_op
,
ref_picture
,
pix_op
,
s
->
mv
[
dir
][
0
][
0
],
s
->
mv
[
dir
][
0
][
1
],
16
,
mb_y
);
s
->
mv
[
dir
][
0
][
0
],
s
->
mv
[
dir
][
0
][
1
],
16
,
mb_y
);
}
}
break
;
break
;
case
MV_TYPE_8X8
:
case
MV_TYPE_8X8
:
if
(
!
is_mpeg12
)
{
if
(
!
is_mpeg12
)
{
mx
=
0
;
mx
=
0
;
my
=
0
;
my
=
0
;
if
(
s
->
quarter_sample
){
if
(
s
->
quarter_sample
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
motion_x
=
s
->
mv
[
dir
][
i
][
0
];
motion_x
=
s
->
mv
[
dir
][
i
][
0
];
motion_y
=
s
->
mv
[
dir
][
i
][
1
];
motion_y
=
s
->
mv
[
dir
][
i
][
1
];
dxy
=
((
motion_y
&
3
)
<<
2
)
|
(
motion_x
&
3
);
dxy
=
((
motion_y
&
3
)
<<
2
)
|
(
motion_x
&
3
);
src_x
=
mb_x
*
16
+
(
motion_x
>>
2
)
+
(
i
&
1
)
*
8
;
src_x
=
mb_x
*
16
+
(
motion_x
>>
2
)
+
(
i
&
1
)
*
8
;
src_y
=
mb_y
*
16
+
(
motion_y
>>
2
)
+
(
i
>>
1
)
*
8
;
src_y
=
mb_y
*
16
+
(
motion_y
>>
2
)
+
(
i
>>
1
)
*
8
;
/* WARNING: do no forget half pels */
/* WARNING: do no forget half pels */
src_x
=
av_clip
(
src_x
,
-
16
,
s
->
width
);
src_x
=
av_clip
(
src_x
,
-
16
,
s
->
width
);
if
(
src_x
==
s
->
width
)
if
(
src_x
==
s
->
width
)
dxy
&=
~
3
;
dxy
&=
~
3
;
src_y
=
av_clip
(
src_y
,
-
16
,
s
->
height
);
src_y
=
av_clip
(
src_y
,
-
16
,
s
->
height
);
if
(
src_y
==
s
->
height
)
if
(
src_y
==
s
->
height
)
dxy
&=
~
12
;
dxy
&=
~
12
;
ptr
=
ref_picture
[
0
]
+
(
src_y
*
s
->
linesize
)
+
(
src_x
);
ptr
=
ref_picture
[
0
]
+
(
src_y
*
s
->
linesize
)
+
(
src_x
);
if
(
s
->
flags
&
CODEC_FLAG_EMU_EDGE
){
if
(
s
->
flags
&
CODEC_FLAG_EMU_EDGE
)
{
if
(
(
unsigned
)
src_x
>
FFMAX
(
s
->
h_edge_pos
-
(
motion_x
&
3
)
-
8
,
0
)
if
((
unsigned
)
src_x
>
FFMAX
(
s
->
h_edge_pos
-
(
motion_x
&
3
)
-
8
,
0
)
||
||
(
unsigned
)
src_y
>
FFMAX
(
s
->
v_edge_pos
-
(
motion_y
&
3
)
-
8
,
0
)){
(
unsigned
)
src_y
>
FFMAX
(
s
->
v_edge_pos
-
(
motion_y
&
3
)
-
8
,
0
))
{
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr
,
s
->
vdsp
.
emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr
,
s
->
linesize
,
9
,
9
,
s
->
linesize
,
src_x
,
src_y
,
9
,
9
,
s
->
h_edge_pos
,
s
->
v_edge_pos
);
src_x
,
src_y
,
ptr
=
s
->
edge_emu_buffer
;
s
->
h_edge_pos
,
s
->
v_edge_pos
);
ptr
=
s
->
edge_emu_buffer
;
}
}
}
}
dest
=
dest_y
+
((
i
&
1
)
*
8
)
+
(
i
>>
1
)
*
8
*
s
->
linesize
;
dest
=
dest_y
+
((
i
&
1
)
*
8
)
+
(
i
>>
1
)
*
8
*
s
->
linesize
;
qpix_op
[
1
][
dxy
](
dest
,
ptr
,
s
->
linesize
);
qpix_op
[
1
][
dxy
](
dest
,
ptr
,
s
->
linesize
);
mx
+=
s
->
mv
[
dir
][
i
][
0
]
/
2
;
mx
+=
s
->
mv
[
dir
][
i
][
0
]
/
2
;
my
+=
s
->
mv
[
dir
][
i
][
1
]
/
2
;
my
+=
s
->
mv
[
dir
][
i
][
1
]
/
2
;
}
}
}
else
{
}
else
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
hpel_motion
(
s
,
dest_y
+
((
i
&
1
)
*
8
)
+
(
i
>>
1
)
*
8
*
s
->
linesize
,
hpel_motion
(
s
,
ref_picture
[
0
],
dest_y
+
((
i
&
1
)
*
8
)
+
(
i
>>
1
)
*
8
*
s
->
linesize
,
mb_x
*
16
+
(
i
&
1
)
*
8
,
mb_y
*
16
+
(
i
>>
1
)
*
8
,
ref_picture
[
0
],
pix_op
[
1
],
mb_x
*
16
+
(
i
&
1
)
*
8
,
s
->
mv
[
dir
][
i
][
0
],
s
->
mv
[
dir
][
i
][
1
]);
mb_y
*
16
+
(
i
>>
1
)
*
8
,
pix_op
[
1
],
mx
+=
s
->
mv
[
dir
][
i
][
0
];
s
->
mv
[
dir
][
i
][
0
],
my
+=
s
->
mv
[
dir
][
i
][
1
];
s
->
mv
[
dir
][
i
][
1
]);
mx
+=
s
->
mv
[
dir
][
i
][
0
];
my
+=
s
->
mv
[
dir
][
i
][
1
];
}
}
}
}
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
))
if
(
!
CONFIG_GRAY
||
!
(
s
->
flags
&
CODEC_FLAG_GRAY
))
chroma_4mv_motion
(
s
,
dest_cb
,
dest_cr
,
ref_picture
,
pix_op
[
1
],
mx
,
my
);
chroma_4mv_motion
(
s
,
dest_cb
,
dest_cr
,
}
ref_picture
,
pix_op
[
1
],
mx
,
my
);
}
break
;
break
;
case
MV_TYPE_FIELD
:
case
MV_TYPE_FIELD
:
if
(
s
->
picture_structure
==
PICT_FRAME
)
{
if
(
s
->
picture_structure
==
PICT_FRAME
)
{
if
(
!
is_mpeg12
&&
s
->
quarter_sample
)
{
if
(
!
is_mpeg12
&&
s
->
quarter_sample
)
{
for
(
i
=
0
;
i
<
2
;
i
++
){
for
(
i
=
0
;
i
<
2
;
i
++
)
qpel_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
qpel_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
1
,
i
,
s
->
field_select
[
dir
][
i
],
1
,
i
,
s
->
field_select
[
dir
][
i
],
ref_picture
,
pix_op
,
qpix_op
,
ref_picture
,
pix_op
,
qpix_op
,
s
->
mv
[
dir
][
i
][
0
],
s
->
mv
[
dir
][
i
][
1
],
8
);
s
->
mv
[
dir
][
i
][
0
],
s
->
mv
[
dir
][
i
][
1
],
8
);
}
}
else
{
}
else
{
/* top field */
/* top field */
mpeg_motion_field
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
mpeg_motion_field
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
0
,
s
->
field_select
[
dir
][
0
],
0
,
s
->
field_select
[
dir
][
0
],
...
@@ -815,66 +879,69 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
...
@@ -815,66 +879,69 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
s
->
mv
[
dir
][
1
][
0
],
s
->
mv
[
dir
][
1
][
1
],
8
,
mb_y
);
s
->
mv
[
dir
][
1
][
0
],
s
->
mv
[
dir
][
1
][
1
],
8
,
mb_y
);
}
}
}
else
{
}
else
{
if
(
s
->
picture_structure
!=
s
->
field_select
[
dir
][
0
]
+
1
&&
s
->
pict_type
!=
AV_PICTURE_TYPE_B
&&
!
s
->
first_field
){
if
(
s
->
picture_structure
!=
s
->
field_select
[
dir
][
0
]
+
1
&&
s
->
pict_type
!=
AV_PICTURE_TYPE_B
&&
!
s
->
first_field
)
{
ref_picture
=
s
->
current_picture_ptr
->
f
.
data
;
ref_picture
=
s
->
current_picture_ptr
->
f
.
data
;
}
}
mpeg_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
mpeg_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
s
->
field_select
[
dir
][
0
],
s
->
field_select
[
dir
][
0
],
ref_picture
,
pix_op
,
ref_picture
,
pix_op
,
s
->
mv
[
dir
][
0
][
0
],
s
->
mv
[
dir
][
0
][
1
],
16
,
mb_y
>>
1
);
s
->
mv
[
dir
][
0
][
0
],
s
->
mv
[
dir
][
0
][
1
],
16
,
mb_y
>>
1
);
}
}
break
;
break
;
case
MV_TYPE_16X8
:
case
MV_TYPE_16X8
:
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
uint8_t
**
ref2picture
;
uint8_t
**
ref2picture
;
if
(
s
->
picture_structure
==
s
->
field_select
[
dir
][
i
]
+
1
if
(
s
->
picture_structure
==
s
->
field_select
[
dir
][
i
]
+
1
||
s
->
pict_type
==
AV_PICTURE_TYPE_B
||
s
->
first_field
)
{
||
s
->
pict_type
==
AV_PICTURE_TYPE_B
||
s
->
first_field
)
{
ref2picture
=
ref_picture
;
ref2picture
=
ref_picture
;
}
else
{
}
else
{
ref2picture
=
s
->
current_picture_ptr
->
f
.
data
;
ref2picture
=
s
->
current_picture_ptr
->
f
.
data
;
}
}
mpeg_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
mpeg_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
s
->
field_select
[
dir
][
i
],
s
->
field_select
[
dir
][
i
],
ref2picture
,
pix_op
,
ref2picture
,
pix_op
,
s
->
mv
[
dir
][
i
][
0
],
s
->
mv
[
dir
][
i
][
1
]
+
16
*
i
,
8
,
mb_y
>>
1
);
s
->
mv
[
dir
][
i
][
0
],
s
->
mv
[
dir
][
i
][
1
]
+
16
*
i
,
8
,
mb_y
>>
1
);
dest_y
+=
16
*
s
->
linesize
;
dest_y
+=
16
*
s
->
linesize
;
dest_cb
+=
(
16
>>
s
->
chroma_y_shift
)
*
s
->
uvlinesize
;
dest_cb
+=
(
16
>>
s
->
chroma_y_shift
)
*
s
->
uvlinesize
;
dest_cr
+=
(
16
>>
s
->
chroma_y_shift
)
*
s
->
uvlinesize
;
dest_cr
+=
(
16
>>
s
->
chroma_y_shift
)
*
s
->
uvlinesize
;
}
}
break
;
break
;
case
MV_TYPE_DMV
:
case
MV_TYPE_DMV
:
if
(
s
->
picture_structure
==
PICT_FRAME
)
{
if
(
s
->
picture_structure
==
PICT_FRAME
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
int
j
;
int
j
;
for
(
j
=
0
;
j
<
2
;
j
++
){
for
(
j
=
0
;
j
<
2
;
j
++
)
mpeg_motion_field
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
mpeg_motion_field
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
j
,
j
^
i
,
ref_picture
,
pix_op
,
j
,
j
^
i
,
ref_picture
,
pix_op
,
s
->
mv
[
dir
][
2
*
i
+
j
][
0
],
s
->
mv
[
dir
][
2
*
i
+
j
][
0
],
s
->
mv
[
dir
][
2
*
i
+
j
][
1
],
8
,
mb_y
);
s
->
mv
[
dir
][
2
*
i
+
j
][
1
],
8
,
mb_y
);
}
pix_op
=
s
->
hdsp
.
avg_pixels_tab
;
pix_op
=
s
->
hdsp
.
avg_pixels_tab
;
}
}
}
else
{
}
else
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
mpeg_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
mpeg_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
s
->
picture_structure
!=
i
+
1
,
s
->
picture_structure
!=
i
+
1
,
ref_picture
,
pix_op
,
ref_picture
,
pix_op
,
s
->
mv
[
dir
][
2
*
i
][
0
],
s
->
mv
[
dir
][
2
*
i
][
1
],
16
,
mb_y
>>
1
);
s
->
mv
[
dir
][
2
*
i
][
0
],
s
->
mv
[
dir
][
2
*
i
][
1
],
16
,
mb_y
>>
1
);
// after put we make avg of the same block
// after put we make avg of the same block
pix_op
=
s
->
hdsp
.
avg_pixels_tab
;
pix_op
=
s
->
hdsp
.
avg_pixels_tab
;
//opposite parity is always in the same frame if this is second field
/* opposite parity is always in the same frame if this is
if
(
!
s
->
first_field
){
* second field */
if
(
!
s
->
first_field
)
{
ref_picture
=
s
->
current_picture_ptr
->
f
.
data
;
ref_picture
=
s
->
current_picture_ptr
->
f
.
data
;
}
}
}
}
}
}
break
;
break
;
default
:
assert
(
0
);
default
:
assert
(
0
);
}
}
}
}
...
@@ -887,7 +954,7 @@ void ff_MPV_motion(MpegEncContext *s,
...
@@ -887,7 +954,7 @@ void ff_MPV_motion(MpegEncContext *s,
qpel_mc_func
(
*
qpix_op
)[
16
])
qpel_mc_func
(
*
qpix_op
)[
16
])
{
{
#if !CONFIG_SMALL
#if !CONFIG_SMALL
if
(
s
->
out_format
==
FMT_MPEG1
)
if
(
s
->
out_format
==
FMT_MPEG1
)
MPV_motion_internal
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
dir
,
MPV_motion_internal
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
dir
,
ref_picture
,
pix_op
,
qpix_op
,
1
);
ref_picture
,
pix_op
,
qpix_op
,
1
);
else
else
...
...
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