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
deb7a6cd
Commit
deb7a6cd
authored
Feb 02, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify
Originally committed as revision 2743 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
77ea0d4b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
66 deletions
+32
-66
mpegvideo.c
libavcodec/mpegvideo.c
+32
-66
No files found.
libavcodec/mpegvideo.c
View file @
deb7a6cd
...
@@ -3298,6 +3298,9 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
...
@@ -3298,6 +3298,9 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
int
i
;
int
i
;
int
skip_dct
[
6
];
int
skip_dct
[
6
];
int
dct_offset
=
s
->
linesize
*
8
;
//default for progressive frames
int
dct_offset
=
s
->
linesize
*
8
;
//default for progressive frames
uint8_t
*
ptr_y
,
*
ptr_cb
,
*
ptr_cr
;
int
wrap_y
,
wrap_c
;
int
emu
=
0
;
for
(
i
=
0
;
i
<
6
;
i
++
)
skip_dct
[
i
]
=
0
;
for
(
i
=
0
;
i
<
6
;
i
++
)
skip_dct
[
i
]
=
0
;
...
@@ -3324,11 +3327,6 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
...
@@ -3324,11 +3327,6 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
ff_set_qscale
(
s
,
last_qp
+
s
->
dquant
);
ff_set_qscale
(
s
,
last_qp
+
s
->
dquant
);
}
}
if
(
s
->
mb_intra
)
{
uint8_t
*
ptr_y
,
*
ptr_cb
,
*
ptr_cr
;
int
wrap_y
,
wrap_c
;
int
emu
=
0
;
wrap_y
=
s
->
linesize
;
wrap_y
=
s
->
linesize
;
wrap_c
=
s
->
uvlinesize
;
wrap_c
=
s
->
uvlinesize
;
ptr_y
=
s
->
new_picture
.
data
[
0
]
+
(
mb_y
*
16
*
wrap_y
)
+
mb_x
*
16
;
ptr_y
=
s
->
new_picture
.
data
[
0
]
+
(
mb_y
*
16
*
wrap_y
)
+
mb_x
*
16
;
...
@@ -3341,6 +3339,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
...
@@ -3341,6 +3339,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
emu
=
1
;
emu
=
1
;
}
}
if
(
s
->
mb_intra
)
{
if
(
s
->
flags
&
CODEC_FLAG_INTERLACED_DCT
){
if
(
s
->
flags
&
CODEC_FLAG_INTERLACED_DCT
){
int
progressive_score
,
interlaced_score
;
int
progressive_score
,
interlaced_score
;
...
@@ -3369,44 +3368,23 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
...
@@ -3369,44 +3368,23 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
skip_dct
[
4
]
=
1
;
skip_dct
[
4
]
=
1
;
skip_dct
[
5
]
=
1
;
skip_dct
[
5
]
=
1
;
}
else
{
}
else
{
if
(
emu
){
if
(
emu
){
//FIXME move out of loop and fix edge_emu_buffer mess
ff_emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_cb
,
wrap_c
,
8
,
8
,
mb_x
*
8
,
mb_y
*
8
,
s
->
width
>>
1
,
s
->
height
>>
1
);
ff_emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_cb
,
wrap_c
,
8
,
8
,
mb_x
*
8
,
mb_y
*
8
,
s
->
width
>>
1
,
s
->
height
>>
1
);
ptr_cb
=
s
->
edge_emu_buffer
;
ptr_cb
=
s
->
edge_emu_buffer
;
ff_emulated_edge_mc
(
s
->
edge_emu_buffer
+
8
,
ptr_cr
,
wrap_c
,
8
,
8
,
mb_x
*
8
,
mb_y
*
8
,
s
->
width
>>
1
,
s
->
height
>>
1
);
ptr_cr
=
s
->
edge_emu_buffer
+
8
;
}
}
s
->
dsp
.
get_pixels
(
s
->
block
[
4
],
ptr_cb
,
wrap_c
);
s
->
dsp
.
get_pixels
(
s
->
block
[
4
],
ptr_cb
,
wrap_c
);
if
(
emu
){
ff_emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_cr
,
wrap_c
,
8
,
8
,
mb_x
*
8
,
mb_y
*
8
,
s
->
width
>>
1
,
s
->
height
>>
1
);
ptr_cr
=
s
->
edge_emu_buffer
;
}
s
->
dsp
.
get_pixels
(
s
->
block
[
5
],
ptr_cr
,
wrap_c
);
s
->
dsp
.
get_pixels
(
s
->
block
[
5
],
ptr_cr
,
wrap_c
);
}
}
if
(
s
->
avctx
->
quantizer_noise_shaping
){
get_vissual_weight
(
weight
[
0
],
ptr_y
,
wrap_y
);
get_vissual_weight
(
weight
[
1
],
ptr_y
+
8
,
wrap_y
);
get_vissual_weight
(
weight
[
2
],
ptr_y
+
dct_offset
,
wrap_y
);
get_vissual_weight
(
weight
[
3
],
ptr_y
+
dct_offset
+
8
,
wrap_y
);
get_vissual_weight
(
weight
[
4
],
ptr_cb
,
wrap_c
);
get_vissual_weight
(
weight
[
5
],
ptr_cr
,
wrap_c
);
memcpy
(
orig
[
0
],
s
->
block
[
0
],
sizeof
(
DCTELEM
)
*
64
*
6
);
}
}
else
{
}
else
{
op_pixels_func
(
*
op_pix
)[
4
];
op_pixels_func
(
*
op_pix
)[
4
];
qpel_mc_func
(
*
op_qpix
)[
16
];
qpel_mc_func
(
*
op_qpix
)[
16
];
uint8_t
*
dest_y
,
*
dest_cb
,
*
dest_cr
;
uint8_t
*
dest_y
,
*
dest_cb
,
*
dest_cr
;
uint8_t
*
ptr_y
,
*
ptr_cb
,
*
ptr_cr
;
int
wrap_y
,
wrap_c
;
int
emu
=
0
;
dest_y
=
s
->
dest
[
0
];
dest_y
=
s
->
dest
[
0
];
dest_cb
=
s
->
dest
[
1
];
dest_cb
=
s
->
dest
[
1
];
dest_cr
=
s
->
dest
[
2
];
dest_cr
=
s
->
dest
[
2
];
wrap_y
=
s
->
linesize
;
wrap_c
=
s
->
uvlinesize
;
ptr_y
=
s
->
new_picture
.
data
[
0
]
+
(
mb_y
*
16
*
wrap_y
)
+
mb_x
*
16
;
ptr_cb
=
s
->
new_picture
.
data
[
1
]
+
(
mb_y
*
8
*
wrap_c
)
+
mb_x
*
8
;
ptr_cr
=
s
->
new_picture
.
data
[
2
]
+
(
mb_y
*
8
*
wrap_c
)
+
mb_x
*
8
;
if
((
!
s
->
no_rounding
)
||
s
->
pict_type
==
B_TYPE
){
if
((
!
s
->
no_rounding
)
||
s
->
pict_type
==
B_TYPE
){
op_pix
=
s
->
dsp
.
put_pixels_tab
;
op_pix
=
s
->
dsp
.
put_pixels_tab
;
...
@@ -3425,12 +3403,6 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
...
@@ -3425,12 +3403,6 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
MPV_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
1
,
s
->
next_picture
.
data
,
op_pix
,
op_qpix
);
MPV_motion
(
s
,
dest_y
,
dest_cb
,
dest_cr
,
1
,
s
->
next_picture
.
data
,
op_pix
,
op_qpix
);
}
}
if
(
mb_x
*
16
+
16
>
s
->
width
||
mb_y
*
16
+
16
>
s
->
height
){
ff_emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_y
,
wrap_y
,
16
,
16
,
mb_x
*
16
,
mb_y
*
16
,
s
->
width
,
s
->
height
);
ptr_y
=
s
->
edge_emu_buffer
;
emu
=
1
;
}
if
(
s
->
flags
&
CODEC_FLAG_INTERLACED_DCT
){
if
(
s
->
flags
&
CODEC_FLAG_INTERLACED_DCT
){
int
progressive_score
,
interlaced_score
;
int
progressive_score
,
interlaced_score
;
...
@@ -3465,12 +3437,10 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
...
@@ -3465,12 +3437,10 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
if
(
emu
){
if
(
emu
){
ff_emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_cb
,
wrap_c
,
8
,
8
,
mb_x
*
8
,
mb_y
*
8
,
s
->
width
>>
1
,
s
->
height
>>
1
);
ff_emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_cb
,
wrap_c
,
8
,
8
,
mb_x
*
8
,
mb_y
*
8
,
s
->
width
>>
1
,
s
->
height
>>
1
);
ptr_cb
=
s
->
edge_emu_buffer
;
ptr_cb
=
s
->
edge_emu_buffer
;
ff_emulated_edge_mc
(
s
->
edge_emu_buffer
+
8
,
ptr_cr
,
wrap_c
,
8
,
8
,
mb_x
*
8
,
mb_y
*
8
,
s
->
width
>>
1
,
s
->
height
>>
1
);
ptr_cr
=
s
->
edge_emu_buffer
+
8
;
}
}
s
->
dsp
.
diff_pixels
(
s
->
block
[
4
],
ptr_cb
,
dest_cb
,
wrap_c
);
s
->
dsp
.
diff_pixels
(
s
->
block
[
4
],
ptr_cb
,
dest_cb
,
wrap_c
);
if
(
emu
){
ff_emulated_edge_mc
(
s
->
edge_emu_buffer
,
ptr_cr
,
wrap_c
,
8
,
8
,
mb_x
*
8
,
mb_y
*
8
,
s
->
width
>>
1
,
s
->
height
>>
1
);
ptr_cr
=
s
->
edge_emu_buffer
;
}
s
->
dsp
.
diff_pixels
(
s
->
block
[
5
],
ptr_cr
,
dest_cr
,
wrap_c
);
s
->
dsp
.
diff_pixels
(
s
->
block
[
5
],
ptr_cr
,
dest_cr
,
wrap_c
);
}
}
/* pre quantization */
/* pre quantization */
...
@@ -3483,6 +3453,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
...
@@ -3483,6 +3453,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
if
(
s
->
dsp
.
sad
[
1
](
NULL
,
ptr_cb
,
dest_cb
,
wrap_c
,
8
)
<
20
*
s
->
qscale
)
skip_dct
[
4
]
=
1
;
if
(
s
->
dsp
.
sad
[
1
](
NULL
,
ptr_cb
,
dest_cb
,
wrap_c
,
8
)
<
20
*
s
->
qscale
)
skip_dct
[
4
]
=
1
;
if
(
s
->
dsp
.
sad
[
1
](
NULL
,
ptr_cr
,
dest_cr
,
wrap_c
,
8
)
<
20
*
s
->
qscale
)
skip_dct
[
5
]
=
1
;
if
(
s
->
dsp
.
sad
[
1
](
NULL
,
ptr_cr
,
dest_cr
,
wrap_c
,
8
)
<
20
*
s
->
qscale
)
skip_dct
[
5
]
=
1
;
}
}
}
if
(
s
->
avctx
->
quantizer_noise_shaping
){
if
(
s
->
avctx
->
quantizer_noise_shaping
){
if
(
!
skip_dct
[
0
])
get_vissual_weight
(
weight
[
0
],
ptr_y
,
wrap_y
);
if
(
!
skip_dct
[
0
])
get_vissual_weight
(
weight
[
0
],
ptr_y
,
wrap_y
);
...
@@ -3493,16 +3464,10 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
...
@@ -3493,16 +3464,10 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
if
(
!
skip_dct
[
5
])
get_vissual_weight
(
weight
[
5
],
ptr_cr
,
wrap_c
);
if
(
!
skip_dct
[
5
])
get_vissual_weight
(
weight
[
5
],
ptr_cr
,
wrap_c
);
memcpy
(
orig
[
0
],
s
->
block
[
0
],
sizeof
(
DCTELEM
)
*
64
*
6
);
memcpy
(
orig
[
0
],
s
->
block
[
0
],
sizeof
(
DCTELEM
)
*
64
*
6
);
}
}
}
/* DCT & quantize */
/* DCT & quantize */
if
(
s
->
out_format
==
FMT_MJPEG
){
assert
(
s
->
out_format
!=
FMT_MJPEG
||
s
->
qscale
==
8
);
for
(
i
=
0
;
i
<
6
;
i
++
)
{
{
int
overflow
;
s
->
block_last_index
[
i
]
=
s
->
dct_quantize
(
s
,
s
->
block
[
i
],
i
,
8
,
&
overflow
);
if
(
overflow
)
clip_coeffs
(
s
,
s
->
block
[
i
],
s
->
block_last_index
[
i
]);
}
}
else
{
for
(
i
=
0
;
i
<
6
;
i
++
)
{
for
(
i
=
0
;
i
<
6
;
i
++
)
{
if
(
!
skip_dct
[
i
]){
if
(
!
skip_dct
[
i
]){
int
overflow
;
int
overflow
;
...
@@ -4037,6 +4002,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
...
@@ -4037,6 +4002,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
}
}
convert_matrix
(
&
s
->
dsp
,
s
->
q_intra_matrix
,
s
->
q_intra_matrix16
,
convert_matrix
(
&
s
->
dsp
,
s
->
q_intra_matrix
,
s
->
q_intra_matrix16
,
s
->
intra_matrix
,
s
->
intra_quant_bias
,
8
,
8
);
s
->
intra_matrix
,
s
->
intra_quant_bias
,
8
,
8
);
s
->
qscale
=
8
;
}
}
//FIXME var duplication
//FIXME var duplication
...
...
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