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
445a7d48
Commit
445a7d48
authored
Feb 10, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegvideo_enc: switch to encode2().
parent
54553842
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
51 additions
and
22 deletions
+51
-22
flvenc.c
libavcodec/flvenc.c
+1
-1
h261enc.c
libavcodec/h261enc.c
+1
-1
mjpegenc.c
libavcodec/mjpegenc.c
+1
-1
mpeg12enc.c
libavcodec/mpeg12enc.c
+2
-2
mpeg4videoenc.c
libavcodec/mpeg4videoenc.c
+1
-1
mpegvideo.h
libavcodec/mpegvideo.h
+10
-1
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+32
-12
rv10enc.c
libavcodec/rv10enc.c
+1
-1
rv20enc.c
libavcodec/rv20enc.c
+1
-1
wmv2enc.c
libavcodec/wmv2enc.c
+1
-1
No files found.
libavcodec/flvenc.c
View file @
445a7d48
...
...
@@ -90,7 +90,7 @@ AVCodec ff_flv_encoder = {
.
id
=
CODEC_ID_FLV1
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
ff_MPV_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Flash Video (FLV) / Sorenson Spark / Sorenson H.263"
),
...
...
libavcodec/h261enc.c
View file @
445a7d48
...
...
@@ -327,7 +327,7 @@ AVCodec ff_h261_encoder = {
.
id
=
CODEC_ID_H261
,
.
priv_data_size
=
sizeof
(
H261Context
),
.
init
=
ff_MPV_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"H.261"
),
...
...
libavcodec/mjpegenc.c
View file @
445a7d48
...
...
@@ -451,7 +451,7 @@ AVCodec ff_mjpeg_encoder = {
.
id
=
CODEC_ID_MJPEG
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
ff_MPV_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUVJ420P
,
PIX_FMT_YUVJ422P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"MJPEG (Motion JPEG)"
),
...
...
libavcodec/mpeg12enc.c
View file @
445a7d48
...
...
@@ -954,7 +954,7 @@ AVCodec ff_mpeg1video_encoder = {
.
id
=
CODEC_ID_MPEG1VIDEO
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
supported_framerates
=
avpriv_frame_rate_tab
+
1
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
...
...
@@ -969,7 +969,7 @@ AVCodec ff_mpeg2video_encoder = {
.
id
=
CODEC_ID_MPEG2VIDEO
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
supported_framerates
=
avpriv_frame_rate_tab
+
1
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_YUV422P
,
PIX_FMT_NONE
},
...
...
libavcodec/mpeg4videoenc.c
View file @
445a7d48
...
...
@@ -1336,7 +1336,7 @@ AVCodec ff_mpeg4_encoder = {
.
id
=
CODEC_ID_MPEG4
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
capabilities
=
CODEC_CAP_DELAY
|
CODEC_CAP_SLICE_THREADS
,
...
...
libavcodec/mpegvideo.h
View file @
445a7d48
...
...
@@ -261,6 +261,14 @@ typedef struct MpegEncContext {
* offsets used in asm. */
int64_t
user_specified_pts
;
///< last non zero pts from AVFrame which was passed into avcodec_encode_video()
/**
* pts difference between the first and second input frame, used for
* calculating dts of the first frame when there's a delay */
int64_t
dts_delta
;
/**
* reordered pts to be used as dts for the next output frame when there's
* a delay */
int64_t
reordered_pts
;
/** bit output */
PutBitContext
pb
;
...
...
@@ -694,7 +702,8 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx);
void
ff_MPV_frame_end
(
MpegEncContext
*
s
);
int
ff_MPV_encode_init
(
AVCodecContext
*
avctx
);
int
ff_MPV_encode_end
(
AVCodecContext
*
avctx
);
int
ff_MPV_encode_picture
(
AVCodecContext
*
avctx
,
unsigned
char
*
buf
,
int
buf_size
,
void
*
data
);
int
ff_MPV_encode_picture
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
frame
,
int
*
got_packet
);
void
ff_MPV_common_init_mmx
(
MpegEncContext
*
s
);
void
ff_MPV_common_init_axp
(
MpegEncContext
*
s
);
void
ff_MPV_common_init_mmi
(
MpegEncContext
*
s
);
...
...
libavcodec/mpegvideo_enc.c
View file @
445a7d48
...
...
@@ -909,6 +909,9 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
"last=%"
PRId64
"
\n
"
,
pts
,
s
->
user_specified_pts
);
return
-
1
;
}
if
(
!
s
->
low_delay
&&
pic_arg
->
display_picture_number
==
1
)
s
->
dts_delta
=
time
-
last
;
}
s
->
user_specified_pts
=
pts
;
}
else
{
...
...
@@ -1374,20 +1377,23 @@ no_output_pic:
return
0
;
}
int
ff_MPV_encode_picture
(
AVCodecContext
*
avctx
,
unsigned
char
*
buf
,
int
buf_size
,
void
*
data
)
int
ff_MPV_encode_picture
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
pic_arg
,
int
*
got_packet
)
{
MpegEncContext
*
s
=
avctx
->
priv_data
;
AVFrame
*
pic_arg
=
data
;
int
i
,
stuffing_count
;
int
i
,
stuffing_count
,
ret
;
int
context_count
=
s
->
slice_context_count
;
if
(
!
pkt
->
data
&&
(
ret
=
ff_alloc_packet
(
pkt
,
s
->
mb_width
*
s
->
mb_height
*
MAX_MB_BYTES
))
<
0
)
return
ret
;
for
(
i
=
0
;
i
<
context_count
;
i
++
)
{
int
start_y
=
s
->
thread_context
[
i
]
->
start_mb_y
;
int
end_y
=
s
->
thread_context
[
i
]
->
end_mb_y
;
int
h
=
s
->
mb_height
;
uint8_t
*
start
=
buf
+
(
size_t
)(((
int64_t
)
buf_
size
)
*
start_y
/
h
);
uint8_t
*
end
=
buf
+
(
size_t
)(((
int64_t
)
buf_
size
)
*
end_y
/
h
);
uint8_t
*
start
=
pkt
->
data
+
(
size_t
)(((
int64_t
)
pkt
->
size
)
*
start_y
/
h
);
uint8_t
*
end
=
pkt
->
data
+
(
size_t
)(((
int64_t
)
pkt
->
size
)
*
end_y
/
h
);
init_put_bits
(
&
s
->
thread_context
[
i
]
->
pb
,
start
,
end
-
start
);
}
...
...
@@ -1547,13 +1553,27 @@ vbv_retry:
}
s
->
total_bits
+=
s
->
frame_bits
;
avctx
->
frame_bits
=
s
->
frame_bits
;
pkt
->
pts
=
s
->
current_picture
.
f
.
pts
;
if
(
!
s
->
low_delay
)
{
if
(
!
s
->
current_picture
.
f
.
coded_picture_number
)
pkt
->
dts
=
pkt
->
pts
-
s
->
dts_delta
;
else
pkt
->
dts
=
s
->
reordered_pts
;
s
->
reordered_pts
=
s
->
input_picture
[
0
]
->
f
.
pts
;
}
else
pkt
->
dts
=
pkt
->
pts
;
if
(
s
->
current_picture
.
f
.
key_frame
)
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
}
else
{
assert
((
put_bits_ptr
(
&
s
->
pb
)
==
s
->
pb
.
buf
));
s
->
frame_bits
=
0
;
}
assert
((
s
->
frame_bits
&
7
)
==
0
);
return
s
->
frame_bits
/
8
;
pkt
->
size
=
s
->
frame_bits
/
8
;
*
got_packet
=
!!
pkt
->
size
;
return
0
;
}
static
inline
void
dct_single_coeff_elimination
(
MpegEncContext
*
s
,
...
...
@@ -4042,7 +4062,7 @@ AVCodec ff_h263_encoder = {
.
id
=
CODEC_ID_H263
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
ff_MPV_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"H.263 / H.263-1996"
),
...
...
@@ -4069,7 +4089,7 @@ AVCodec ff_h263p_encoder = {
.
id
=
CODEC_ID_H263P
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
ff_MPV_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
capabilities
=
CODEC_CAP_SLICE_THREADS
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
...
...
@@ -4083,7 +4103,7 @@ AVCodec ff_msmpeg4v2_encoder = {
.
id
=
CODEC_ID_MSMPEG4V2
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
ff_MPV_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"MPEG-4 part 2 Microsoft variant version 2"
),
...
...
@@ -4095,7 +4115,7 @@ AVCodec ff_msmpeg4v3_encoder = {
.
id
=
CODEC_ID_MSMPEG4V3
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
ff_MPV_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"MPEG-4 part 2 Microsoft variant version 3"
),
...
...
@@ -4107,7 +4127,7 @@ AVCodec ff_wmv1_encoder = {
.
id
=
CODEC_ID_WMV1
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
ff_MPV_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Windows Media Video 7"
),
...
...
libavcodec/rv10enc.c
View file @
445a7d48
...
...
@@ -62,7 +62,7 @@ AVCodec ff_rv10_encoder = {
.
id
=
CODEC_ID_RV10
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
ff_MPV_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"RealVideo 1.0"
),
...
...
libavcodec/rv20enc.c
View file @
445a7d48
...
...
@@ -63,7 +63,7 @@ AVCodec ff_rv20_encoder = {
.
id
=
CODEC_ID_RV20
,
.
priv_data_size
=
sizeof
(
MpegEncContext
),
.
init
=
ff_MPV_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"RealVideo 2.0"
),
...
...
libavcodec/wmv2enc.c
View file @
445a7d48
...
...
@@ -217,7 +217,7 @@ AVCodec ff_wmv2_encoder = {
.
id
=
CODEC_ID_WMV2
,
.
priv_data_size
=
sizeof
(
Wmv2Context
),
.
init
=
wmv2_encode_init
,
.
encode
=
ff_MPV_encode_picture
,
.
encode
2
=
ff_MPV_encode_picture
,
.
close
=
ff_MPV_encode_end
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Windows Media Video 8"
),
...
...
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