22 #include "libavutil/intreadwrite.h"
23 #include "libavutil/imgutils.h"
53 int * n_datum,
int is_big)
58 *lbuf =
read32(ptr, is_big);
62 *lbuf = (*lbuf << 10) | (*lbuf >> 22);
73 int buf_size = avpkt->
size;
78 int magic_num, endian;
80 int w, h, bits_per_color, descriptor, elements, packing, total_size;
83 unsigned int rgbBuffer = 0;
86 if (avpkt->
size <= 1634) {
96 if (magic_num ==
AV_RL32(
"SDPX")) {
98 }
else if (magic_num ==
AV_RB32(
"SDPX")) {
105 offset =
read32(&buf, endian);
106 if (avpkt->
size <= offset) {
111 buf = avpkt->
data + 0x304;
127 bits_per_color = buf[0];
129 packing =
read16(&buf, endian);
130 encoding =
read16(&buf, endian);
151 switch (descriptor) {
167 switch (bits_per_color) {
169 total_size = avctx->
width * avctx->
height * elements;
176 total_size = (avctx->
width * elements + 2) / 3 * 4 * avctx->
height;
183 total_size = 2 * avctx->
width * avctx->
height * elements;
186 total_size = 2 * avctx->
width * avctx->
height * elements;
197 switch (1000 * descriptor + 10 * bits_per_color + endian) {
258 if (total_size + (int64_t)offset > avpkt->
size) {
262 switch (bits_per_color) {
264 for (x = 0; x < avctx->
height; x++) {
265 uint16_t *dst[3] = {(uint16_t*)ptr[0],
268 for (y = 0; y < avctx->
width; y++) {
281 for (i = 0; i < 3; i++)
286 for (x = 0; x < avctx->
height; x++) {
287 uint16_t *dst[3] = {(uint16_t*)ptr[0],
290 for (y = 0; y < avctx->
width; y++) {
291 *dst[2] =
read16(&buf, endian) >> 4;
293 *dst[0] =
read16(&buf, endian) >> 4;
295 *dst[1] =
read16(&buf, endian) >> 4;
301 for (i = 0; i < 3; i++)
309 buf, elements * avctx->
width,
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AVERROR_PATCHWELCOME
This structure describes decoded (raw) audio or video data.
packed RGB 8:8:8, 24bpp, RGBRGB...
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
#define AV_PIX_FMT_GBRP10
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
if((e=av_dict_get(options,"", NULL, AV_DICT_IGNORE_SUFFIX)))
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
static const uint8_t offset[511][2]
static unsigned int read16(const uint8_t **ptr, int is_big)
const char * name
Name of the codec implementation.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
static unsigned int read32(const uint8_t **ptr, int is_big)
#define AV_NUM_DATA_POINTERS
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Libavcodec external API header.
#define AV_PIX_FMT_GBRP12
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
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 uint16_t read10in32(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big)
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
rational number numerator/denominator
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
Y , 16bpp, little-endian.
common internal api header.
#define AVERROR_INVALIDDATA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...