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
a2f27818
Commit
a2f27818
authored
Sep 25, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amvenc: fix quant tables
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
f2f28861
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+22
-6
No files found.
libavcodec/mpegvideo_enc.c
View file @
a2f27818
...
...
@@ -44,6 +44,7 @@
#include "mpeg4video.h"
#include "internal.h"
#include <limits.h>
#include "sp5x.h"
//#undef NDEBUG
//#include <assert.h>
...
...
@@ -528,14 +529,9 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
// return -1;
}
if
(
s
->
mpeg_quant
||
s
->
codec_id
==
CODEC_ID_MPEG1VIDEO
||
s
->
codec_id
==
CODEC_ID_MPEG2VIDEO
||
s
->
codec_id
==
CODEC_ID_MJPEG
){
if
(
s
->
mpeg_quant
||
s
->
codec_id
==
CODEC_ID_MPEG1VIDEO
||
s
->
codec_id
==
CODEC_ID_MPEG2VIDEO
||
s
->
codec_id
==
CODEC_ID_MJPEG
||
s
->
codec_id
==
CODEC_ID_AMV
){
s
->
intra_quant_bias
=
3
<<
(
QUANT_BIAS_SHIFT
-
3
);
//(a + x*3/8)/x
s
->
inter_quant_bias
=
0
;
}
else
if
(
s
->
codec_id
==
CODEC_ID_AMV
){
s
->
intra_quant_bias
=
0
;
s
->
inter_quant_bias
=
0
;
s
->
fixed_qscale
=
1
;
s
->
adaptive_quant
=
0
;
}
else
{
s
->
intra_quant_bias
=
0
;
s
->
inter_quant_bias
=-
(
1
<<
(
QUANT_BIAS_SHIFT
-
2
));
//(a - x/4)/x
...
...
@@ -2099,6 +2095,11 @@ static int encode_thread(AVCodecContext *c, void *arg){
s
->
current_picture
.
f
.
error
[
i
]
=
0
;
}
if
(
s
->
codec_id
==
CODEC_ID_AMV
){
s
->
last_dc
[
0
]
=
128
*
8
/
13
;
s
->
last_dc
[
1
]
=
128
*
8
/
14
;
s
->
last_dc
[
2
]
=
128
*
8
/
14
;
}
s
->
mb_skip_run
=
0
;
memset
(
s
->
last_mv
,
0
,
sizeof
(
s
->
last_mv
));
...
...
@@ -2941,6 +2942,21 @@ static int encode_picture(MpegEncContext *s, int picture_number)
s
->
intra_matrix
,
s
->
intra_quant_bias
,
8
,
8
,
1
);
s
->
qscale
=
8
;
}
if
(
s
->
codec_id
==
CODEC_ID_AMV
){
static
const
uint8_t
y
[
32
]
=
{
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
};
static
const
uint8_t
c
[
32
]
=
{
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
,
14
};
for
(
i
=
1
;
i
<
64
;
i
++
){
int
j
=
s
->
dsp
.
idct_permutation
[
ff_zigzag_direct
[
i
]];
s
->
intra_matrix
[
j
]
=
sp5x_quant_table
[
5
*
2
][
i
];
}
s
->
y_dc_scale_table
=
y
;
s
->
c_dc_scale_table
=
c
;
s
->
intra_matrix
[
0
]
=
14
;
ff_convert_matrix
(
&
s
->
dsp
,
s
->
q_intra_matrix
,
s
->
q_intra_matrix16
,
s
->
intra_matrix
,
s
->
intra_quant_bias
,
8
,
8
,
1
);
s
->
qscale
=
8
;
}
//FIXME var duplication
s
->
current_picture_ptr
->
f
.
key_frame
=
...
...
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