52 const unsigned char *
buf;
57 #define ADVANCE_BLOCK() \
60 if (pixel_ptr >= width) \
63 row_ptr += stride * 4; \
66 if (total_blocks < 0) \
68 av_log(s->avctx, AV_LOG_ERROR, "warning: block counter just went negative (this should not happen)\n"); \
77 int row_inc = stride - 4;
82 unsigned short colorA = 0, colorB;
83 unsigned short color4[4];
84 unsigned char index, idx;
85 unsigned short ta, tb;
86 unsigned short *pixels = (
unsigned short *)s->
frame.
data[0];
95 if (s->
buf[stream_ptr] != 0xe1)
100 chunk_size =
AV_RB32(&s->
buf[stream_ptr]) & 0x00FFFFFF;
104 if (chunk_size != s->
size)
107 chunk_size = s->
size;
113 while (stream_ptr < chunk_size) {
114 opcode = s->
buf[stream_ptr++];
116 n_blocks = (opcode & 0x1f) + 1;
119 if ((opcode & 0x80) == 0) {
120 colorA = (opcode << 8) | (s->
buf[stream_ptr++]);
122 if ((s->
buf[stream_ptr] & 0x80) != 0) {
131 n_blocks =
FFMIN(n_blocks, total_blocks);
133 switch (opcode & 0xe0) {
147 block_ptr = row_ptr + pixel_ptr;
148 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
149 for (pixel_x = 0; pixel_x < 4; pixel_x++){
150 pixels[block_ptr] = colorA;
153 block_ptr += row_inc;
174 ta = (colorA >> 10) & 0x1F;
175 tb = (colorB >> 10) & 0x1F;
176 color4[1] |= ((11 * ta + 21 * tb) >> 5) << 10;
177 color4[2] |= ((21 * ta + 11 * tb) >> 5) << 10;
180 ta = (colorA >> 5) & 0x1F;
181 tb = (colorB >> 5) & 0x1F;
182 color4[1] |= ((11 * ta + 21 * tb) >> 5) << 5;
183 color4[2] |= ((21 * ta + 11 * tb) >> 5) << 5;
188 color4[1] |= ((11 * ta + 21 * tb) >> 5);
189 color4[2] |= ((21 * ta + 11 * tb) >> 5);
191 if (s->
size - stream_ptr < n_blocks * 4)
194 block_ptr = row_ptr + pixel_ptr;
195 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
196 index = s->
buf[stream_ptr++];
197 for (pixel_x = 0; pixel_x < 4; pixel_x++){
198 idx = (index >> (2 * (3 - pixel_x))) & 0x03;
199 pixels[block_ptr] = color4[idx];
202 block_ptr += row_inc;
210 if (s->
size - stream_ptr < 30)
212 block_ptr = row_ptr + pixel_ptr;
213 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
214 for (pixel_x = 0; pixel_x < 4; pixel_x++){
216 if ((pixel_y != 0) || (pixel_x !=0)) {
220 pixels[block_ptr] = colorA;
223 block_ptr += row_inc;
231 " Skip remaining %d bytes of chunk data.\n", opcode,
232 chunk_size - stream_ptr);
251 void *
data,
int *got_frame,
255 int buf_size = avpkt->
size;
static int rpza_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
This structure describes decoded (raw) audio or video data.
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.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
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)
#define AV_PIX_FMT_RGB555
static int init(AVCodecParserContext *s)
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.
common internal API header
int width
picture width / height.
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)
const unsigned char * buf
#define FF_BUFFER_HINTS_REUSABLE
#define FF_BUFFER_HINTS_PRESERVE
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal and external API header
#define FF_BUFFER_HINTS_VALID
This structure stores compressed data.
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)