28 #define BIT_PLANAR 0x00
29 #define BYTE_PLANAR 0x20
32 #define BYTE_LINE 0xC0
65 unsigned r = ((rgb >> 8) & 0xF) * 0x11;
66 unsigned g = ((rgb >> 4) & 0xF) * 0x11;
67 unsigned b = (rgb & 0xF) * 0x11;
68 AV_WN32(&new_palette[i], (r << 16) | (g << 8) | b);
78 for (plane = 0; plane < c->
bpp; plane++) {
81 out[linesize * y + x] |=
get_bits1(&gb) << plane;
94 for (plane = 0; plane < c->
bpp; plane++) {
96 out[linesize * y + x] |=
get_bits1(&gb) << plane;
118 uint32_t *new_palette = (uint32_t *)c->
frame.
data[1];
127 uint32_t new_palette[16],
r,
g,
b;
137 for (y = 0; y < avctx->
height; y++) {
138 r = new_palette[0] & 0xFF0000;
139 g = new_palette[0] & 0xFF00;
140 b = new_palette[0] & 0xFF;
141 for (x = 0; x < avctx->
width; x++) {
147 r = new_palette[
index] & 0xFF0000;
148 g = new_palette[
index] & 0xFF00;
149 b = new_palette[
index] & 0xFF;
155 r = index * 0x11 << 16;
158 g = index * 0x11 << 8;
161 AV_WL24(out + x * 3, r | g | b);
170 uint32_t new_palette[64],
r,
g,
b;
180 for (y = 0; y < avctx->
height; y++) {
181 r = new_palette[0] & 0xFF0000;
182 g = new_palette[0] & 0xFF00;
183 b = new_palette[0] & 0xFF;
184 for (x = 0; x < avctx->
width; x++) {
190 r = new_palette[
index] & 0xFF0000;
191 g = new_palette[
index] & 0xFF00;
192 b = new_palette[
index] & 0xFF;
195 b = (index << 2) | (b & 3);
198 r = (index << 18) | (r & (3 << 16));
201 g = (index << 10) | (g & (3 << 8));
204 AV_WL24(out + x * 3, r | g | b);
215 int ret, w, h, encoding, aligned_width, buf_size = pkt->
size;
220 encoding = buf[1] & 7;
221 c->
format = buf[1] & 0xE0;
232 if (buf_size < c->palette_size + 32)
252 }
else if (encoding == 1 && (c->
bpp == 6 || c->
bpp == 8)) {
This structure describes decoded (raw) audio or video data.
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer with padding, reusing the given one if large enough.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
8 bit with PIX_FMT_RGB32 palette
static av_cold int cdxl_decode_end(AVCodecContext *avctx)
bitstream reader API header.
static void cdxl_decode_ham8(CDXLVideoContext *c)
static int init(AVCodecParserContext *s)
static int cdxl_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static void bitline2chunky(CDXLVideoContext *c, int linesize, uint8_t *out)
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
static av_cold int cdxl_decode_init(AVCodecContext *avctx)
packed RGB 8:8:8, 24bpp, BGRBGR...
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
static unsigned int get_bits1(GetBitContext *s)
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define FF_INPUT_BUFFER_PADDING_SIZE
static void cdxl_decode_ham6(CDXLVideoContext *c)
static void bitplanar2chunky(CDXLVideoContext *c, int linesize, uint8_t *out)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
common internal api header.
#define AVERROR_INVALIDDATA
#define AVERROR_PATCHWELCOME
static void import_format(CDXLVideoContext *c, int linesize, uint8_t *out)
This structure stores compressed data.
static void cdxl_decode_rgb(CDXLVideoContext *c)
static void import_palette(CDXLVideoContext *c, uint32_t *new_palette)