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
278d8868
Commit
278d8868
authored
Feb 12, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffv1enc: switch to encode2().
parent
f7fa73ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
11 deletions
+23
-11
ffv1.c
libavcodec/ffv1.c
+23
-11
No files found.
libavcodec/ffv1.c
View file @
278d8868
...
...
@@ -1080,17 +1080,25 @@ static int encode_slice(AVCodecContext *c, void *arg){
return
0
;
}
static
int
encode_frame
(
AVCodecContext
*
avctx
,
unsigned
char
*
buf
,
int
buf_size
,
void
*
data
){
static
int
encode_frame
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
pict
,
int
*
got_packet
)
{
FFV1Context
*
f
=
avctx
->
priv_data
;
RangeCoder
*
const
c
=
&
f
->
slice_context
[
0
]
->
c
;
AVFrame
*
pict
=
data
;
AVFrame
*
const
p
=
&
f
->
picture
;
int
used_count
=
0
;
uint8_t
keystate
=
128
;
uint8_t
*
buf_p
;
int
i
;
int
i
,
ret
;
if
(
!
pkt
->
data
&&
(
ret
=
av_new_packet
(
pkt
,
avctx
->
width
*
avctx
->
height
*
((
8
*
2
+
1
+
1
)
*
4
)
/
8
+
FF_MIN_BUFFER_SIZE
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error getting output packet.
\n
"
);
return
ret
;
}
ff_init_range_encoder
(
c
,
buf
,
buf_
size
);
ff_init_range_encoder
(
c
,
pkt
->
data
,
pkt
->
size
);
ff_build_rac_states
(
c
,
0
.
05
*
(
1LL
<<
32
),
256
-
8
);
*
p
=
*
pict
;
...
...
@@ -1110,7 +1118,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
if
(
!
f
->
ac
){
used_count
+=
ff_rac_terminate
(
c
);
//printf("pos=%d\n", used_count);
init_put_bits
(
&
f
->
slice_context
[
0
]
->
pb
,
buf
+
used_count
,
buf_
size
-
used_count
);
init_put_bits
(
&
f
->
slice_context
[
0
]
->
pb
,
pkt
->
data
+
used_count
,
pkt
->
size
-
used_count
);
}
else
if
(
f
->
ac
>
1
){
int
i
;
for
(
i
=
1
;
i
<
256
;
i
++
){
...
...
@@ -1121,8 +1129,8 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
for
(
i
=
1
;
i
<
f
->
slice_count
;
i
++
){
FFV1Context
*
fs
=
f
->
slice_context
[
i
];
uint8_t
*
start
=
buf
+
(
buf_
size
-
used_count
)
*
i
/
f
->
slice_count
;
int
len
=
buf_
size
/
f
->
slice_count
;
uint8_t
*
start
=
pkt
->
data
+
(
pkt
->
size
-
used_count
)
*
i
/
f
->
slice_count
;
int
len
=
pkt
->
size
/
f
->
slice_count
;
if
(
fs
->
ac
){
ff_init_range_encoder
(
&
fs
->
c
,
start
,
len
);
...
...
@@ -1132,7 +1140,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
}
avctx
->
execute
(
avctx
,
encode_slice
,
&
f
->
slice_context
[
0
],
NULL
,
f
->
slice_count
,
sizeof
(
void
*
));
buf_p
=
buf
;
buf_p
=
pkt
->
data
;
for
(
i
=
0
;
i
<
f
->
slice_count
;
i
++
){
FFV1Context
*
fs
=
f
->
slice_context
[
i
];
int
bytes
;
...
...
@@ -1147,7 +1155,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
used_count
=
0
;
}
if
(
i
>
0
){
av_assert0
(
bytes
<
buf_
size
/
f
->
slice_count
);
av_assert0
(
bytes
<
pkt
->
size
/
f
->
slice_count
);
memmove
(
buf_p
,
fs
->
ac
?
fs
->
c
.
bytestream_start
:
fs
->
pb
.
buf
,
bytes
);
av_assert0
(
bytes
<
(
1
<<
24
));
AV_WB24
(
buf_p
+
bytes
,
bytes
);
...
...
@@ -1200,7 +1208,11 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
avctx
->
stats_out
[
0
]
=
'\0'
;
f
->
picture_number
++
;
return
buf_p
-
buf
;
pkt
->
size
=
buf_p
-
pkt
->
data
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
*
p
->
key_frame
;
*
got_packet
=
1
;
return
0
;
}
#endif
/* CONFIG_FFV1_ENCODER */
...
...
@@ -1742,7 +1754,7 @@ AVCodec ff_ffv1_encoder = {
.
id
=
CODEC_ID_FFV1
,
.
priv_data_size
=
sizeof
(
FFV1Context
),
.
init
=
encode_init
,
.
encode
=
encode_frame
,
.
encode
2
=
encode_frame
,
.
close
=
common_end
,
.
capabilities
=
CODEC_CAP_SLICE_THREADS
,
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV420P
,
PIX_FMT_YUV444P
,
PIX_FMT_YUV422P
,
PIX_FMT_YUV411P
,
PIX_FMT_YUV410P
,
PIX_FMT_RGB32
,
PIX_FMT_YUV420P16
,
PIX_FMT_YUV422P16
,
PIX_FMT_YUV444P16
,
PIX_FMT_NONE
},
...
...
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