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
2a85a192
Commit
2a85a192
authored
11 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
bmpenc: use the AVFrame API properly.
parent
6a08d7fc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavcodec/bmp.h
+0
-4
0 additions, 4 deletions
libavcodec/bmp.h
libavcodec/bmpenc.c
+15
-11
15 additions, 11 deletions
libavcodec/bmpenc.c
with
15 additions
and
15 deletions
libavcodec/bmp.h
+
0
−
4
View file @
2a85a192
...
...
@@ -24,10 +24,6 @@
#include
"avcodec.h"
typedef
struct
BMPContext
{
AVFrame
picture
;
}
BMPContext
;
typedef
enum
{
BMP_RGB
=
0
,
BMP_RLE8
=
1
,
...
...
This diff is collapsed.
Click to expand it.
libavcodec/bmpenc.c
+
15
−
11
View file @
2a85a192
...
...
@@ -31,11 +31,6 @@ static const uint32_t rgb565_masks[] = { 0xF800, 0x07E0, 0x001F };
static
const
uint32_t
rgb444_masks
[]
=
{
0x0F00
,
0x00F0
,
0x000F
};
static
av_cold
int
bmp_encode_init
(
AVCodecContext
*
avctx
){
BMPContext
*
s
=
avctx
->
priv_data
;
avcodec_get_frame_defaults
(
&
s
->
picture
);
avctx
->
coded_frame
=
&
s
->
picture
;
switch
(
avctx
->
pix_fmt
)
{
case
AV_PIX_FMT_BGR24
:
avctx
->
bits_per_coded_sample
=
24
;
...
...
@@ -61,22 +56,25 @@ static av_cold int bmp_encode_init(AVCodecContext *avctx){
return
-
1
;
}
avctx
->
coded_frame
=
av_frame_alloc
();
if
(
!
avctx
->
coded_frame
)
return
AVERROR
(
ENOMEM
);
return
0
;
}
static
int
bmp_encode_frame
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
pict
,
int
*
got_packet
)
{
BMPContext
*
s
=
avctx
->
priv_data
;
AVFrame
*
const
p
=
&
s
->
picture
;
const
AVFrame
*
const
p
=
pict
;
int
n_bytes_image
,
n_bytes_per_row
,
n_bytes
,
i
,
n
,
hsize
,
ret
;
const
uint32_t
*
pal
=
NULL
;
int
pad_bytes_per_row
,
pal_entries
=
0
,
compression
=
BMP_RGB
;
int
bit_count
=
avctx
->
bits_per_coded_sample
;
uint8_t
*
ptr
,
*
buf
;
*
p
=
*
pict
;
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
p
->
key_frame
=
1
;
avctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
avctx
->
coded_frame
->
key_frame
=
1
;
switch
(
avctx
->
pix_fmt
)
{
case
AV_PIX_FMT_RGB444
:
compression
=
BMP_BITFIELDS
;
...
...
@@ -159,14 +157,20 @@ static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return
0
;
}
static
av_cold
int
bmp_encode_close
(
AVCodecContext
*
avctx
)
{
av_frame_free
(
&
avctx
->
coded_frame
);
return
0
;
}
AVCodec
ff_bmp_encoder
=
{
.
name
=
"bmp"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"BMP (Windows and OS/2 bitmap)"
),
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_BMP
,
.
priv_data_size
=
sizeof
(
BMPContext
),
.
init
=
bmp_encode_init
,
.
encode2
=
bmp_encode_frame
,
.
close
=
bmp_encode_close
,
.
pix_fmts
=
(
const
enum
AVPixelFormat
[]){
AV_PIX_FMT_BGR24
,
AV_PIX_FMT_RGB555
,
AV_PIX_FMT_RGB444
,
AV_PIX_FMT_RGB565
,
...
...
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