50 const unsigned char *
buf;
55 #define ADVANCE_BLOCK() \
58 if (pixel_ptr >= width) \
61 row_ptr += stride * 4; \
64 if (total_blocks < 0) \
66 av_log(s->avctx, AV_LOG_ERROR, "warning: block counter just went negative (this should not happen)\n"); \
75 int row_inc = stride - 4;
80 unsigned short colorA = 0, colorB;
81 unsigned short color4[4];
82 unsigned char index, idx;
83 unsigned short ta, tb;
84 unsigned short *pixels = (
unsigned short *)s->
frame.
data[0];
93 if (s->
buf[stream_ptr] != 0xe1)
98 chunk_size =
AV_RB32(&s->
buf[stream_ptr]) & 0x00FFFFFF;
102 if (chunk_size != s->
size)
105 chunk_size = s->
size;
111 while (stream_ptr < chunk_size) {
112 opcode = s->
buf[stream_ptr++];
114 n_blocks = (opcode & 0x1f) + 1;
117 if ((opcode & 0x80) == 0) {
118 colorA = (opcode << 8) | (s->
buf[stream_ptr++]);
120 if ((s->
buf[stream_ptr] & 0x80) != 0) {
129 n_blocks =
FFMIN(n_blocks, total_blocks);
131 switch (opcode & 0xe0) {
145 block_ptr = row_ptr + pixel_ptr;
146 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
147 for (pixel_x = 0; pixel_x < 4; pixel_x++){
148 pixels[block_ptr] = colorA;
151 block_ptr += row_inc;
172 ta = (colorA >> 10) & 0x1F;
173 tb = (colorB >> 10) & 0x1F;
174 color4[1] |= ((11 * ta + 21 * tb) >> 5) << 10;
175 color4[2] |= ((21 * ta + 11 * tb) >> 5) << 10;
178 ta = (colorA >> 5) & 0x1F;
179 tb = (colorB >> 5) & 0x1F;
180 color4[1] |= ((11 * ta + 21 * tb) >> 5) << 5;
181 color4[2] |= ((21 * ta + 11 * tb) >> 5) << 5;
186 color4[1] |= ((11 * ta + 21 * tb) >> 5);
187 color4[2] |= ((21 * ta + 11 * tb) >> 5);
189 if (s->
size - stream_ptr < n_blocks * 4)
192 block_ptr = row_ptr + pixel_ptr;
193 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
194 index = s->
buf[stream_ptr++];
195 for (pixel_x = 0; pixel_x < 4; pixel_x++){
196 idx = (index >> (2 * (3 - pixel_x))) & 0x03;
197 pixels[block_ptr] = color4[idx];
200 block_ptr += row_inc;
208 if (s->
size - stream_ptr < 30)
210 block_ptr = row_ptr + pixel_ptr;
211 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
212 for (pixel_x = 0; pixel_x < 4; pixel_x++){
214 if ((pixel_y != 0) || (pixel_x !=0)) {
218 pixels[block_ptr] = colorA;
221 block_ptr += row_inc;
229 " Skip remaining %d bytes of chunk data.\n", opcode,
230 chunk_size - stream_ptr);
249 void *
data,
int *data_size,
252 const uint8_t *buf = avpkt->
data;
253 int buf_size = avpkt->
size;
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
AV_WL32 AV_WL24 AV_WL16 AV_WB32 AV_WB24 AV_RB16
#define FF_BUFFER_HINTS_VALID
AV_WL32 AV_WL24 AV_WL16 AV_RB32
struct RpzaContext RpzaContext
int buffer_hints
codec suggestion on buffer type if != 0
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
int(* reget_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of a frame to get cr buffer for it.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static void rpza_decode_stream(RpzaContext *s)
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static int rpza_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static av_cold int rpza_decode_end(AVCodecContext *avctx)
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.
int width
picture width / height.
struct AVFrame AVFrame
Audio Video Frame.
#define FF_BUFFER_HINTS_REUSABLE
static av_cold int rpza_decode_init(AVCodecContext *avctx)
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)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_BUFFER_HINTS_PRESERVE
const unsigned char * buf
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal and external API header