50 dst = dst + height *
stride;
53 code = bytestream2_get_byte(&qctx->
buffer);
58 c0 = bytestream2_get_byte(&qctx->
buffer);
59 c1 = bytestream2_get_byte(&qctx->
buffer);
60 run = ((code & 0x7) << 16) + (c0 << 8) + c1 + 2;
61 }
else if (code >= 0xF0) {
62 c0 = bytestream2_get_byte(&qctx->
buffer);
63 run = ((code & 0xF) << 8) + c0 + 2;
64 }
else if (code >= 0xE0) {
65 run = (code & 0x1F) + 2;
66 }
else if (code >= 0xC0) {
67 c0 = bytestream2_get_byte(&qctx->
buffer);
68 c1 = bytestream2_get_byte(&qctx->
buffer);
69 copy = ((code & 0x3F) << 16) + (c0 << 8) + c1 + 1;
70 }
else if (code >= 0x80) {
71 c0 = bytestream2_get_byte(&qctx->
buffer);
72 copy = ((code & 0x7F) << 8) + c0 + 1;
81 p = bytestream2_get_byte(&qctx->
buffer);
82 for(i = 0; i <
run; i++) {
83 int step =
FFMIN(run - i, width - filled);
84 memset(dst+filled, p, step);
87 if (filled >= width) {
91 while (run - i > width && rows_to_go > 0) {
92 memset(dst, p, width);
104 for(i = 0; i <
copy; i++) {
105 dst[filled++] = bytestream2_get_byte(&qctx->
buffer);
106 if (filled >= width) {
119 { 0x00, 0x20, 0x20, 0x20, 0x18, 0x10, 0x10, 0x20, 0x10, 0x08, 0x18, 0x08, 0x08, 0x18, 0x10, 0x04};
121 { 0x00, 0x20, 0x18, 0x08, 0x18, 0x10, 0x20, 0x10, 0x08, 0x10, 0x20, 0x20, 0x08, 0x10, 0x18, 0x04};
136 for (i = 0; i <
height; i++)
137 memcpy(dst + (i * stride), refdata + (i * stride), width);
144 dst = dst + height *
stride;
147 code = bytestream2_get_byte(&qctx->
buffer);
154 int me_w, me_h, me_x, me_y;
164 corr = bytestream2_get_byte(&qctx->
buffer);
177 if ((me_x + filled < 0) || (me_x + me_w + filled > width) ||
178 (height - me_y - me_h < 0) || (height - me_y >= orig_height) ||
179 (filled + me_w > width) || (height - me_h < 0))
181 me_x, me_y, me_w, me_h, filled, height);
184 me_plane = refdata + (filled + me_x) + (height - me_y) *
stride;
185 for(j = 0; j < me_h; j++) {
186 for(i = 0; i < me_w; i++)
187 dst[filled + i - (j * stride)] = me_plane[i - (j *
stride)];
191 code = bytestream2_get_byte(&qctx->
buffer);
201 p = bytestream2_get_byte(&qctx->
buffer);
202 for(i = 0; i <=
code; i++) {
204 if(filled >= width) {
212 }
else if(code >= 0xC0) {
218 for(i = 0; i <=
code; i++) {
219 dst[filled++] = bytestream2_get_byte(&qctx->
buffer);
220 if(filled >= width) {
228 }
else if(code >= 0x80) {
235 skip = bytestream2_get_byte(&qctx->
buffer) + 64;
237 skip = bytestream2_get_byte(&qctx->
buffer) + 320;
241 while( filled >= width) {
251 dst[filled++] = ctable[code & 0x7F];
255 if(filled >= width) {
265 void *
data,
int *got_frame,
277 if (avpkt->
size < 0x86) {
289 outdata = p->
data[0];
294 delta = bytestream2_get_byte(&a->
buffer);
326 for (i=0; i<pal_size/4; i++)
const char const char void * val
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static void copy(const float *p1, float *p2, const int length)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static void flush(AVCodecContext *avctx)
static av_cold int init(AVCodecContext *avctx)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
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)
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
8 bits with AV_PIX_FMT_RGB32 palette
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst, int stride, int width, int height)
static av_cold int decode_init(AVCodecContext *avctx)
#define i(width, name, range_min, range_max)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette...
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
const char * name
Name of the codec implementation.
static void decode_flush(AVCodecContext *avctx)
int width
picture width / height.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static const int qpeg_table_w[16]
static const int qpeg_table_h[16]
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
static void av_noinline qpeg_decode_inter(QpegContext *qctx, uint8_t *dst, int stride, int width, int height, int delta, const uint8_t *ctable, uint8_t *refdata)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int palette_has_changed
Tell user application that palette has changed from previous frame.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
GLint GLenum GLboolean GLsizei stride
common internal api header.
static av_cold int decode_end(AVCodecContext *avctx)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame 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.Frame references ownership and permissions
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step