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
32277700
Commit
32277700
authored
Feb 12, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
roqvideoenc: switch to encode2().
parent
4fd7cfef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
roqvideoenc.c
libavcodec/roqvideoenc.c
+16
-9
No files found.
libavcodec/roqvideoenc.c
View file @
32277700
...
@@ -59,6 +59,7 @@
...
@@ -59,6 +59,7 @@
#include "roqvideo.h"
#include "roqvideo.h"
#include "bytestream.h"
#include "bytestream.h"
#include "elbg.h"
#include "elbg.h"
#include "internal.h"
#include "mathops.h"
#include "mathops.h"
#define CHROMA_BIAS 1
#define CHROMA_BIAS 1
...
@@ -1001,13 +1002,12 @@ static void roq_write_video_info_chunk(RoqContext *enc)
...
@@ -1001,13 +1002,12 @@ static void roq_write_video_info_chunk(RoqContext *enc)
bytestream_put_byte
(
&
enc
->
out_buf
,
0x00
);
bytestream_put_byte
(
&
enc
->
out_buf
,
0x00
);
}
}
static
int
roq_encode_frame
(
AVCodecContext
*
avctx
,
unsigned
char
*
buf
,
int
buf_size
,
void
*
data
)
static
int
roq_encode_frame
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
frame
,
int
*
got_packet
)
{
{
RoqContext
*
enc
=
avctx
->
priv_data
;
RoqContext
*
enc
=
avctx
->
priv_data
;
const
AVFrame
*
frame
=
data
;
int
size
,
ret
;
uint8_t
*
buf_start
=
buf
;
enc
->
out_buf
=
buf
;
enc
->
avctx
=
avctx
;
enc
->
avctx
=
avctx
;
enc
->
frame_to_enc
=
frame
;
enc
->
frame_to_enc
=
frame
;
...
@@ -1019,10 +1019,12 @@ static int roq_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
...
@@ -1019,10 +1019,12 @@ static int roq_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
/* 138 bits max per 8x8 block +
/* 138 bits max per 8x8 block +
* 256 codebooks*(6 bytes 2x2 + 4 bytes 4x4) + 8 bytes frame header */
* 256 codebooks*(6 bytes 2x2 + 4 bytes 4x4) + 8 bytes frame header */
if
(((
enc
->
width
*
enc
->
height
/
64
)
*
138
+
7
)
/
8
+
256
*
(
6
+
4
)
+
8
>
buf_size
)
{
size
=
((
enc
->
width
*
enc
->
height
/
64
)
*
138
+
7
)
/
8
+
256
*
(
6
+
4
)
+
8
;
av_log
(
avctx
,
AV_LOG_ERROR
,
" RoQ: Output buffer too small!
\n
"
);
if
((
ret
=
ff_alloc_packet
(
pkt
,
size
))
<
0
)
{
return
-
1
;
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error getting output packet with size %d.
\n
"
,
size
);
return
ret
;
}
}
enc
->
out_buf
=
pkt
->
data
;
/* Check for I frame */
/* Check for I frame */
if
(
enc
->
framesSinceKeyframe
==
avctx
->
gop_size
)
if
(
enc
->
framesSinceKeyframe
==
avctx
->
gop_size
)
...
@@ -1046,7 +1048,12 @@ static int roq_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
...
@@ -1046,7 +1048,12 @@ static int roq_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
/* Encode the actual frame */
/* Encode the actual frame */
roq_encode_video
(
enc
);
roq_encode_video
(
enc
);
return
enc
->
out_buf
-
buf_start
;
pkt
->
size
=
enc
->
out_buf
-
pkt
->
data
;
if
(
enc
->
framesSinceKeyframe
==
1
)
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
*
got_packet
=
1
;
return
0
;
}
}
static
int
roq_encode_end
(
AVCodecContext
*
avctx
)
static
int
roq_encode_end
(
AVCodecContext
*
avctx
)
...
@@ -1071,7 +1078,7 @@ AVCodec ff_roq_encoder = {
...
@@ -1071,7 +1078,7 @@ AVCodec ff_roq_encoder = {
.
id
=
CODEC_ID_ROQ
,
.
id
=
CODEC_ID_ROQ
,
.
priv_data_size
=
sizeof
(
RoqContext
),
.
priv_data_size
=
sizeof
(
RoqContext
),
.
init
=
roq_encode_init
,
.
init
=
roq_encode_init
,
.
encode
=
roq_encode_frame
,
.
encode
2
=
roq_encode_frame
,
.
close
=
roq_encode_end
,
.
close
=
roq_encode_end
,
.
supported_framerates
=
(
const
AVRational
[]){{
30
,
1
},
{
0
,
0
}},
.
supported_framerates
=
(
const
AVRational
[]){{
30
,
1
},
{
0
,
0
}},
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV444P
,
PIX_FMT_NONE
},
.
pix_fmts
=
(
const
enum
PixelFormat
[]){
PIX_FMT_YUV444P
,
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