41 const uint8_t *buf = avpkt->
data;
42 const uint8_t *buf_end = avpkt->
data + avpkt->
size;
46 unsigned int offset, w, h, y,
stride, bytes_per_pixel;
49 if (buf_end - buf < 14)
54 bytes_per_pixel =
AV_RL16(buf+12) >> 3;
56 if (bytes_per_pixel != 2) {
63 if (buf_end - buf < offset)
87 for (y = 0; y < h && buf_end - buf >= w * bytes_per_pixel; y++) {
90 for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel)
93 memcpy(ptr, buf, w*bytes_per_pixel);
96 buf += w*bytes_per_pixel;
107 return offset + w*h*bytes_per_pixel;
int(* get_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of each frame to get a buffer for it.
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
struct PTXContext PTXContext
AVFrame * coded_frame
the picture in the bitstream
#define AV_LOG_WARNING
Something somehow does not look correct.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static av_cold int ptx_init(AVCodecContext *avctx)
static av_cold int ptx_end(AVCodecContext *avctx)
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#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 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.
static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
struct AVPicture AVPicture
four components are given, that's all.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.