29 void *
data,
int *got_frame,
33 int buf_size = avpkt->
size;
35 unsigned int fsize, hsize;
40 int i, j,
n, linesize,
ret;
41 uint32_t rgb[3] = {0};
53 if (bytestream_get_byte(&buf) !=
'B' ||
54 bytestream_get_byte(&buf) !=
'M') {
59 fsize = bytestream_get_le32(&buf);
60 if (buf_size < fsize) {
69 hsize = bytestream_get_le32(&buf);
70 ihsize = bytestream_get_le32(&buf);
71 if (ihsize + 14 > hsize) {
77 if (fsize == 14 || fsize == ihsize + 14)
92 width = bytestream_get_le32(&buf);
93 height = bytestream_get_le32(&buf);
96 width = bytestream_get_le16(&buf);
97 height = bytestream_get_le16(&buf);
105 if (bytestream_get_le16(&buf) != 1) {
110 depth = bytestream_get_le16(&buf);
113 comp = bytestream_get_le32(&buf);
125 rgb[0] = bytestream_get_le32(&buf);
126 rgb[1] = bytestream_get_le32(&buf);
127 rgb[2] = bytestream_get_le32(&buf);
128 alpha = bytestream_get_le32(&buf);
139 if (rgb[0] == 0xFF000000 && rgb[1] == 0x00FF0000 && rgb[2] == 0x0000FF00)
141 else if (rgb[0] == 0x00FF0000 && rgb[1] == 0x0000FF00 && rgb[2] == 0x000000FF)
143 else if (rgb[0] == 0x0000FF00 && rgb[1] == 0x00FF0000 && rgb[2] == 0xFF000000)
145 else if (rgb[0] == 0x000000FF && rgb[1] == 0x0000FF00 && rgb[2] == 0x00FF0000)
148 av_log(avctx,
AV_LOG_ERROR,
"Unknown bitfields %0X %0X %0X\n", rgb[0], rgb[1], rgb[2]);
162 if (rgb[0] == 0xF800 && rgb[1] == 0x07E0 && rgb[2] == 0x001F)
164 else if (rgb[0] == 0x7C00 && rgb[1] == 0x03E0 && rgb[2] == 0x001F)
166 else if (rgb[0] == 0x0F00 && rgb[1] == 0x00F0 && rgb[2] == 0x000F)
169 av_log(avctx,
AV_LOG_ERROR,
"Unknown bitfields %0X %0X %0X\n", rgb[0], rgb[1], rgb[2]);
175 if (hsize - ihsize - 14 > 0)
182 if (hsize - ihsize - 14 > 0) {
205 dsize = buf_size - hsize;
208 n = ((avctx->
width * depth + 31) / 8) & ~3;
212 dsize, n * avctx->
height);
229 int colors = 1 <<
depth;
231 memset(p->
data[1], 0, 1024);
236 t = bytestream_get_le32(&buf);
237 if (t < 0 || t > (1 << depth)) {
238 av_log(avctx,
AV_LOG_ERROR,
"Incorrect number of colors - %X for bitdepth %d\n", t, depth);
243 buf = buf0 + 14 + ihsize;
245 if ((hsize-ihsize-14) < (colors << 2)) {
246 if ((hsize-ihsize-14) < colors * 3) {
250 for (i = 0; i < colors; i++)
251 ((uint32_t*)p->
data[1])[
i] = (0xFF
U<<24) | bytestream_get_le24(&buf);
253 for (i = 0; i < colors; i++)
254 ((uint32_t*)p->
data[1])[i] = 0xFFU << 24 | bytestream_get_le32(&buf);
272 for (i = 0; i < avctx->
height; i++) {
274 for (j = 0; j <
n; j++) {
275 ptr[j*8+0] = buf[j] >> 7;
276 ptr[j*8+1] = (buf[j] >> 6) & 1;
277 ptr[j*8+2] = (buf[j] >> 5) & 1;
278 ptr[j*8+3] = (buf[j] >> 4) & 1;
279 ptr[j*8+4] = (buf[j] >> 3) & 1;
280 ptr[j*8+5] = (buf[j] >> 2) & 1;
281 ptr[j*8+6] = (buf[j] >> 1) & 1;
282 ptr[j*8+7] = buf[j] & 1;
291 for (i = 0; i < avctx->
height; i++) {
298 for (i = 0; i < avctx->
height; i++) {
300 for (j = 0; j <
n; j++) {
301 ptr[j*2+0] = (buf[j] >> 4) & 0xF;
302 ptr[j*2+1] = buf[j] & 0xF;
309 for (i = 0; i < avctx->
height; i++) {
310 const uint16_t *
src = (
const uint16_t *) buf;
311 uint16_t *
dst = (uint16_t *) ptr;
313 for (j = 0; j < avctx->
width; j++)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
packed BGR 8:8:8, 32bpp, 0BGR0BGR...
#define AV_PIX_FMT_RGB444
four components are given, that's all.
packed RGB 8:8:8, 32bpp, RGB0RGB0...
8 bit with PIX_FMT_RGB32 palette
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static double alpha(void *priv, double x, double y)
static int bmp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
packed RGB 8:8:8, 24bpp, BGRBGR...
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
BYTE int const BYTE int int int height
synthesis window for stochastic i
packed BGR 8:8:8, 32bpp, BGR0BGR0...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Buffer references ownership and permissions
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
#define AV_PIX_FMT_RGB555
int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic, int depth, GetByteContext *gb)
Decode stream in MS RLE format into frame.
else dst[i][x+y *dst_stride[i]]
int key_frame
1 -> keyframe, 0-> not
#define AV_PIX_FMT_RGB565
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
packed RGB 8:8:8, 32bpp, 0RGB0RGB...
This structure stores compressed data.