annotate bmpenc.c @ 10483:afad312b9989 libavcodec

Implement AMR gain function that is used by both AMR and SIPR. Based on AMR SoC code by Robert Swain and Colin McQuillan.
author vitor
date Sat, 31 Oct 2009 02:02:30 +0000
parents 98fdef0c35a1
children 8a4984c5cacc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4477
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
1 /*
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
2 * BMP image format encoder
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
3 * Copyright (c) 2006, 2007 Michel Bardiaux
9164
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
4 * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
4477
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
5 *
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
6 * This file is part of FFmpeg.
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
7 *
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
12 *
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
16 * Lesser General Public License for more details.
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
17 *
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
21 */
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
22
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
23 #include "avcodec.h"
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
24 #include "bytestream.h"
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
25 #include "bmp.h"
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
26
9164
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
27 static const uint32_t monoblack_pal[] = { 0x000000, 0xFFFFFF };
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
28 static const uint32_t rgb565_masks[] = { 0xF800, 0x07E0, 0x001F };
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
29
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 4477
diff changeset
30 static av_cold int bmp_encode_init(AVCodecContext *avctx){
4477
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
31 BMPContext *s = avctx->priv_data;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
32
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
33 avcodec_get_frame_defaults((AVFrame*)&s->picture);
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
34 avctx->coded_frame = (AVFrame*)&s->picture;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
35
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
36 return 0;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
37 }
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
38
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
39 static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
40 BMPContext *s = avctx->priv_data;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
41 AVFrame *pict = data;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
42 AVFrame * const p= (AVFrame*)&s->picture;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
43 int n_bytes_image, n_bytes_per_row, n_bytes, i, n, hsize;
9164
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
44 const uint32_t *pal = NULL;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
45 int pad_bytes_per_row, bit_count, pal_entries = 0, compression = BMP_RGB;
4477
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
46 uint8_t *ptr;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
47 unsigned char* buf0 = buf;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
48 *p = *pict;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
49 p->pict_type= FF_I_TYPE;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
50 p->key_frame= 1;
9164
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
51 switch (avctx->pix_fmt) {
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
52 case PIX_FMT_BGR24:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
53 bit_count = 24;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
54 break;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
55 case PIX_FMT_RGB555:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
56 bit_count = 16;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
57 break;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
58 case PIX_FMT_RGB565:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
59 bit_count = 16;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
60 compression = BMP_BITFIELDS;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
61 pal = rgb565_masks; // abuse pal to hold color masks
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
62 pal_entries = 3;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
63 break;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
64 case PIX_FMT_RGB8:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
65 case PIX_FMT_BGR8:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
66 case PIX_FMT_RGB4_BYTE:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
67 case PIX_FMT_BGR4_BYTE:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
68 case PIX_FMT_GRAY8:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
69 case PIX_FMT_PAL8:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
70 bit_count = 8;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
71 pal = (uint32_t *)p->data[1];
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
72 break;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
73 case PIX_FMT_MONOBLACK:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
74 bit_count = 1;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
75 pal = monoblack_pal;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
76 break;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
77 default:
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
78 return -1;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
79 }
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
80 if (pal && !pal_entries) pal_entries = 1 << bit_count;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
81 n_bytes_per_row = ((int64_t)avctx->width * (int64_t)bit_count + 7LL) >> 3LL;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
82 pad_bytes_per_row = (4 - n_bytes_per_row) & 3;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
83 n_bytes_image = avctx->height * (n_bytes_per_row + pad_bytes_per_row);
4477
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
84
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
85 // STRUCTURE.field refer to the MSVC documentation for BITMAPFILEHEADER
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
86 // and related pages.
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
87 #define SIZE_BITMAPFILEHEADER 14
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
88 #define SIZE_BITMAPINFOHEADER 40
9164
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
89 hsize = SIZE_BITMAPFILEHEADER + SIZE_BITMAPINFOHEADER + (pal_entries << 2);
4477
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
90 n_bytes = n_bytes_image + hsize;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
91 if(n_bytes>buf_size) {
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
92 av_log(avctx, AV_LOG_ERROR, "buf size too small (need %d, got %d)\n", n_bytes, buf_size);
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
93 return -1;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
94 }
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
95 bytestream_put_byte(&buf, 'B'); // BITMAPFILEHEADER.bfType
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
96 bytestream_put_byte(&buf, 'M'); // do.
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
97 bytestream_put_le32(&buf, n_bytes); // BITMAPFILEHEADER.bfSize
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
98 bytestream_put_le16(&buf, 0); // BITMAPFILEHEADER.bfReserved1
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
99 bytestream_put_le16(&buf, 0); // BITMAPFILEHEADER.bfReserved2
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
100 bytestream_put_le32(&buf, hsize); // BITMAPFILEHEADER.bfOffBits
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
101 bytestream_put_le32(&buf, SIZE_BITMAPINFOHEADER); // BITMAPINFOHEADER.biSize
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
102 bytestream_put_le32(&buf, avctx->width); // BITMAPINFOHEADER.biWidth
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
103 bytestream_put_le32(&buf, avctx->height); // BITMAPINFOHEADER.biHeight
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
104 bytestream_put_le16(&buf, 1); // BITMAPINFOHEADER.biPlanes
9164
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
105 bytestream_put_le16(&buf, bit_count); // BITMAPINFOHEADER.biBitCount
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
106 bytestream_put_le32(&buf, compression); // BITMAPINFOHEADER.biCompression
4477
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
107 bytestream_put_le32(&buf, n_bytes_image); // BITMAPINFOHEADER.biSizeImage
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
108 bytestream_put_le32(&buf, 0); // BITMAPINFOHEADER.biXPelsPerMeter
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
109 bytestream_put_le32(&buf, 0); // BITMAPINFOHEADER.biYPelsPerMeter
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
110 bytestream_put_le32(&buf, 0); // BITMAPINFOHEADER.biClrUsed
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
111 bytestream_put_le32(&buf, 0); // BITMAPINFOHEADER.biClrImportant
9164
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
112 for (i = 0; i < pal_entries; i++)
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
113 bytestream_put_le32(&buf, pal[i] & 0xFFFFFF);
4477
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
114 // BMP files are bottom-to-top so we start from the end...
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
115 ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
116 buf = buf0 + hsize;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
117 for(i = 0; i < avctx->height; i++) {
9164
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
118 if (bit_count == 16) {
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
119 const uint16_t *src = (const uint16_t *) ptr;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
120 uint16_t *dst = (uint16_t *) buf;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
121 for(n = 0; n < avctx->width; n++)
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
122 AV_WL16(dst + n, src[n]);
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
123 } else {
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
124 memcpy(buf, ptr, n_bytes_per_row);
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
125 }
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
126 buf += n_bytes_per_row;
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
127 memset(buf, 0, pad_bytes_per_row);
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
128 buf += pad_bytes_per_row;
4477
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
129 ptr -= p->linesize[0]; // ... and go back
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
130 }
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
131 return n_bytes;
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
132 }
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
133
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
134 AVCodec bmp_encoder = {
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
135 "bmp",
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
136 CODEC_TYPE_VIDEO,
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
137 CODEC_ID_BMP,
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
138 sizeof(BMPContext),
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
139 bmp_encode_init,
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
140 bmp_encode_frame,
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
141 NULL, //encode_end,
10147
98fdef0c35a1 Cosmetics: Fix typo.
cehoyos
parents: 10146
diff changeset
142 .pix_fmts = (const enum PixelFormat[]){
9164
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
143 PIX_FMT_BGR24,
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
144 PIX_FMT_RGB555, PIX_FMT_RGB565,
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
145 PIX_FMT_RGB8, PIX_FMT_BGR8, PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8,
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
146 PIX_FMT_MONOBLACK,
c48f55549c06 Add 1bpp, 8bpp, 15bpp, and 16bpp support to BMP encoder.
cehoyos
parents: 7040
diff changeset
147 PIX_FMT_NONE},
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6788
diff changeset
148 .long_name = NULL_IF_CONFIG_SMALL("BMP image"),
4477
87e943798698 BMP encoder by Michel Bardiaux, mbardiaux mediaxim be
diego
parents:
diff changeset
149 };