Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
32277700
Commit
32277700
authored
13 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
roqvideoenc: switch to encode2().
parent
4fd7cfef
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/roqvideoenc.c
+16
-9
16 additions, 9 deletions
libavcodec/roqvideoenc.c
with
16 additions
and
9 deletions
libavcodec/roqvideoenc.c
+
16
−
9
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
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment