32 static unsigned int read32(
const uint8_t **ptr,
int is_big)
49 return value + (value >> 10);
57 const uint8_t *buf = avpkt->
data;
58 const uint8_t *buf_end = avpkt->
data + avpkt->
size;
59 int buf_size = avpkt->
size;
65 int magic_num, offset, endian;
67 int w, h,
stride, bits_per_color, descriptor, elements, target_packet_size, source_packet_size;
69 unsigned int rgbBuffer;
71 if (avpkt->
size <= 1634) {
81 if (magic_num ==
AV_RL32(
"SDPX")) {
83 }
else if (magic_num ==
AV_RB32(
"SDPX")) {
90 offset =
read32(&buf, endian);
91 if (avpkt->
size <= offset) {
96 buf = avpkt->
data + 0x304;
107 bits_per_color = buf[0];
113 switch (descriptor) {
125 switch (bits_per_color) {
132 source_packet_size = elements;
133 target_packet_size = elements;
137 target_packet_size = 6;
138 source_packet_size = 4;
147 target_packet_size = 6;
148 source_packet_size = elements * 2;
167 buf = avpkt->
data + offset;
172 if (source_packet_size*avctx->
width*avctx->
height > buf_end - buf) {
176 switch (bits_per_color) {
178 for (x = 0; x < avctx->
height; x++) {
179 uint16_t *dst = (uint16_t*)ptr;
180 for (y = 0; y < avctx->
width; y++) {
181 rgbBuffer =
read32(&buf, endian);
193 if (source_packet_size == target_packet_size) {
194 for (x = 0; x < avctx->
height; x++) {
195 memcpy(ptr, buf, target_packet_size*avctx->
width);
197 buf += source_packet_size*avctx->
width;
200 for (x = 0; x < avctx->
height; x++) {
202 for (y = 0; y < avctx->
width; y++) {
203 memcpy(dst, buf, target_packet_size);
204 dst += target_packet_size;
205 buf += source_packet_size;
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.
AV_WL32 AV_WL24 AV_WL16 AV_RB32
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
AVFrame * coded_frame
the picture in the bitstream
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static av_cold int decode_end(AVCodecContext *avctx)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static unsigned int read32(const uint8_t **ptr, int is_big)
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
static int init(AVCodecParserContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
struct DPXContext DPXContext
static unsigned make_16bit(unsigned value)
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...
int width
picture width / height.
static av_cold int 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.
struct AVPicture AVPicture
four components are given, that's all.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
packed RGB 8:8:8, 24bpp, RGBRGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.