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
87f8cab4
Commit
87f8cab4
authored
Aug 06, 2002
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpeg4 mpeg quantizer encoding
Originally committed as revision 844 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
508abaca
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
15 deletions
+28
-15
avcodec.h
libavcodec/avcodec.h
+3
-4
h263.c
libavcodec/h263.c
+10
-5
mpegvideo_mmx_template.c
libavcodec/i386/mpegvideo_mmx_template.c
+2
-1
mpegvideo.c
libavcodec/mpegvideo.c
+10
-5
mpegvideo.h
libavcodec/mpegvideo.h
+3
-0
No files found.
libavcodec/avcodec.h
View file @
87f8cab4
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
#define LIBAVCODEC_VERSION_INT 0x000406
#define LIBAVCODEC_VERSION_INT 0x000406
#define LIBAVCODEC_VERSION "0.4.6"
#define LIBAVCODEC_VERSION "0.4.6"
#define LIBAVCODEC_BUILD 461
8
#define LIBAVCODEC_BUILD 461
9
#define LIBAVCODEC_BUILD_STR "461
8
"
#define LIBAVCODEC_BUILD_STR "461
9
"
enum
CodecID
{
enum
CodecID
{
CODEC_ID_NONE
,
CODEC_ID_NONE
,
...
@@ -278,6 +278,7 @@ typedef struct AVCodecContext {
...
@@ -278,6 +278,7 @@ typedef struct AVCodecContext {
int
parse_only
;
/* decoding only: if true, only parsing is done
int
parse_only
;
/* decoding only: if true, only parsing is done
(function avcodec_parse_frame()). The frame
(function avcodec_parse_frame()). The frame
data is returned. Only MPEG codecs support this now. */
data is returned. Only MPEG codecs support this now. */
int
mpeg_quant
;
/* 0-> h263 quant 1-> mpeg quant */
//FIXME this should be reordered after kabis API is finished ...
//FIXME this should be reordered after kabis API is finished ...
/*
/*
...
@@ -300,8 +301,6 @@ typedef struct AVCodecContext {
...
@@ -300,8 +301,6 @@ typedef struct AVCodecContext {
unsigned
long
int
unsigned
long
int
ul_res0
,
ul_res1
,
ul_res2
,
ul_res3
,
ul_res4
,
ul_res5
,
ul_res0
,
ul_res1
,
ul_res2
,
ul_res3
,
ul_res4
,
ul_res5
,
ul_res6
,
ul_res7
,
ul_res8
,
ul_res9
,
ul_res10
,
ul_res11
,
ul_res12
;
ul_res6
,
ul_res7
,
ul_res8
,
ul_res9
,
ul_res10
,
ul_res11
,
ul_res12
;
unsigned
int
ui_res0
;
unsigned
short
int
unsigned
short
int
us_res0
,
us_res1
,
us_res2
,
us_res3
,
us_res4
,
us_res5
,
us_res0
,
us_res1
,
us_res2
,
us_res3
,
us_res4
,
us_res5
,
us_res6
,
us_res7
,
us_res8
,
us_res9
,
us_res10
,
us_res11
,
us_res12
;
us_res6
,
us_res7
,
us_res8
,
us_res9
,
us_res10
,
us_res11
,
us_res12
;
...
...
libavcodec/h263.c
View file @
87f8cab4
...
@@ -1122,10 +1122,13 @@ void h263_encode_init(MpegEncContext *s)
...
@@ -1122,10 +1122,13 @@ void h263_encode_init(MpegEncContext *s)
s
->
c_dc_scale_table
=
ff_mpeg1_dc_scale_table
;
s
->
c_dc_scale_table
=
ff_mpeg1_dc_scale_table
;
}
}
/* h263 type bias */
if
(
s
->
mpeg_quant
){
//FIXME mpeg4 mpeg quantizer
s
->
intra_quant_bias
=
3
<<
(
QUANT_BIAS_SHIFT
-
3
);
//(a + x*3/8)/x
s
->
intra_quant_bias
=
0
;
s
->
inter_quant_bias
=
0
;
s
->
inter_quant_bias
=-
(
1
<<
(
QUANT_BIAS_SHIFT
-
2
));
//(a - x/4)/x
}
else
{
s
->
intra_quant_bias
=
0
;
s
->
inter_quant_bias
=-
(
1
<<
(
QUANT_BIAS_SHIFT
-
2
));
//(a - x/4)/x
}
}
}
static
void
h263_encode_block
(
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
)
static
void
h263_encode_block
(
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
)
...
@@ -1274,7 +1277,9 @@ static void mpeg4_encode_vol_header(MpegEncContext * s)
...
@@ -1274,7 +1277,9 @@ static void mpeg4_encode_vol_header(MpegEncContext * s)
put_bits
(
&
s
->
pb
,
2
,
s
->
vol_sprite_usage
=
0
);
/* sprite enable */
put_bits
(
&
s
->
pb
,
2
,
s
->
vol_sprite_usage
=
0
);
/* sprite enable */
}
}
put_bits
(
&
s
->
pb
,
1
,
0
);
/* not 8 bit */
put_bits
(
&
s
->
pb
,
1
,
0
);
/* not 8 bit */
put_bits
(
&
s
->
pb
,
1
,
0
);
/* quant type= h263 style*/
put_bits
(
&
s
->
pb
,
1
,
s
->
mpeg_quant
);
/* quant type= (0=h263 style)*/
if
(
s
->
mpeg_quant
)
put_bits
(
&
s
->
pb
,
2
,
0
);
/* no custom matrixes */
if
(
vo_ver_id
!=
1
)
if
(
vo_ver_id
!=
1
)
put_bits
(
&
s
->
pb
,
1
,
s
->
quarter_sample
=
0
);
put_bits
(
&
s
->
pb
,
1
,
s
->
quarter_sample
=
0
);
put_bits
(
&
s
->
pb
,
1
,
1
);
/* complexity estimation disable */
put_bits
(
&
s
->
pb
,
1
,
1
);
/* complexity estimation disable */
...
...
libavcodec/i386/mpegvideo_mmx_template.c
View file @
87f8cab4
...
@@ -82,7 +82,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
...
@@ -82,7 +82,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
qmat
=
s
->
q_inter_matrix16
[
qscale
];
qmat
=
s
->
q_inter_matrix16
[
qscale
];
}
}
if
(
s
->
out_format
==
FMT_H263
){
if
(
s
->
out_format
==
FMT_H263
&&
s
->
mpeg_quant
==
0
){
asm
volatile
(
asm
volatile
(
"movd %%eax, %%mm3
\n\t
"
// last_non_zero_p1
"movd %%eax, %%mm3
\n\t
"
// last_non_zero_p1
...
@@ -189,6 +189,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
...
@@ -189,6 +189,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
}
}
if
(
s
->
mb_intra
)
temp_block
[
0
]
=
level
;
//FIXME move afer permute
if
(
s
->
mb_intra
)
temp_block
[
0
]
=
level
;
//FIXME move afer permute
// last_non_zero_p1=64;
// last_non_zero_p1=64;
/* permute for IDCT */
/* permute for IDCT */
asm
volatile
(
asm
volatile
(
...
...
libavcodec/mpegvideo.c
View file @
87f8cab4
...
@@ -390,6 +390,7 @@ int MPV_encode_init(AVCodecContext *avctx)
...
@@ -390,6 +390,7 @@ int MPV_encode_init(AVCodecContext *avctx)
s
->
chroma_elim_threshold
=
avctx
->
chroma_elim_threshold
;
s
->
chroma_elim_threshold
=
avctx
->
chroma_elim_threshold
;
s
->
strict_std_compliance
=
avctx
->
strict_std_compliance
;
s
->
strict_std_compliance
=
avctx
->
strict_std_compliance
;
s
->
data_partitioning
=
avctx
->
flags
&
CODEC_FLAG_PART
;
s
->
data_partitioning
=
avctx
->
flags
&
CODEC_FLAG_PART
;
s
->
mpeg_quant
=
avctx
->
mpeg_quant
;
if
(
s
->
gop_size
<=
1
)
{
if
(
s
->
gop_size
<=
1
)
{
s
->
intra_only
=
1
;
s
->
intra_only
=
1
;
...
@@ -542,12 +543,16 @@ int MPV_encode_init(AVCodecContext *avctx)
...
@@ -542,12 +543,16 @@ int MPV_encode_init(AVCodecContext *avctx)
/* init default q matrix */
/* init default q matrix */
for
(
i
=
0
;
i
<
64
;
i
++
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
if
(
s
->
out_format
==
FMT_H263
)
if
(
s
->
codec_id
==
CODEC_ID_MPEG4
&&
s
->
mpeg_quant
){
s
->
intra_matrix
[
i
]
=
ff_mpeg1_default_non_intra_matrix
[
i
];
s
->
intra_matrix
[
i
]
=
ff_mpeg4_default_intra_matrix
[
i
];
else
s
->
inter_matrix
[
i
]
=
ff_mpeg4_default_non_intra_matrix
[
i
];
}
else
if
(
s
->
out_format
==
FMT_H263
){
s
->
intra_matrix
[
i
]
=
s
->
inter_matrix
[
i
]
=
ff_mpeg1_default_non_intra_matrix
[
i
];
}
else
{
/* mpeg1 */
s
->
intra_matrix
[
i
]
=
ff_mpeg1_default_intra_matrix
[
i
];
s
->
intra_matrix
[
i
]
=
ff_mpeg1_default_intra_matrix
[
i
];
s
->
inter_matrix
[
i
]
=
ff_mpeg1_default_non_intra_matrix
[
i
];
s
->
inter_matrix
[
i
]
=
ff_mpeg1_default_non_intra_matrix
[
i
];
}
}
}
/* precompute matrix */
/* precompute matrix */
...
...
libavcodec/mpegvideo.h
View file @
87f8cab4
...
@@ -521,6 +521,9 @@ static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
...
@@ -521,6 +521,9 @@ static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
extern
UINT8
ff_mpeg4_y_dc_scale_table
[
32
];
extern
UINT8
ff_mpeg4_y_dc_scale_table
[
32
];
extern
UINT8
ff_mpeg4_c_dc_scale_table
[
32
];
extern
UINT8
ff_mpeg4_c_dc_scale_table
[
32
];
extern
INT16
ff_mpeg4_default_intra_matrix
[
64
];
extern
INT16
ff_mpeg4_default_non_intra_matrix
[
64
];
void
h263_encode_mb
(
MpegEncContext
*
s
,
void
h263_encode_mb
(
MpegEncContext
*
s
,
DCTELEM
block
[
6
][
64
],
DCTELEM
block
[
6
][
64
],
int
motion_x
,
int
motion_y
);
int
motion_x
,
int
motion_y
);
...
...
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