48 unsigned int offset, w, h, y,
stride, bytes_per_pixel;
51 if (buf_end - buf < 14)
56 bytes_per_pixel =
AV_RL16(buf+12) >> 3;
58 if (bytes_per_pixel != 2) {
65 if (buf_end - buf < offset)
89 for (y = 0; y < h && buf_end - buf >= w * bytes_per_pixel; y++) {
92 for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel)
95 memcpy(ptr, buf, w*bytes_per_pixel);
98 buf += w*bytes_per_pixel;
109 return offset + w*h*bytes_per_pixel;
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.
struct PTXContext PTXContext
AVFrame * coded_frame
the picture in the bitstream
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
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)
#define AV_PIX_FMT_RGB555
static int init(AVCodecParserContext *s)
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
#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 int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
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.
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)
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
common internal and external API header
#define AVERROR_INVALIDDATA
#define AVERROR_PATCHWELCOME
This structure stores compressed data.