88 int *n_datum,
int is_big,
int shift)
95 *lbuf =
read32(ptr, is_big);
106 int *n_datum,
int is_big,
int shift)
111 *lbuf =
read32(ptr, is_big);
115 *lbuf = *lbuf << 10 | *lbuf >>
shift & 0x3FFFFF;
117 return *lbuf & 0x3FF;
121 int *n_datum,
int is_big)
126 *lbuf =
read32(ptr, is_big);
131 case 7:
return *lbuf & 0xFFF;
132 case 6:
return (*lbuf >> 12) & 0xFFF;
134 uint32_t
c = *lbuf >> 24;
135 *lbuf =
read32(ptr, is_big);
139 case 4:
return (*lbuf >> 4) & 0xFFF;
140 case 3:
return (*lbuf >> 16) & 0xFFF;
142 uint32_t
c = *lbuf >> 28;
143 *lbuf =
read32(ptr, is_big);
147 case 1:
return (*lbuf >> 8) & 0xFFF;
148 default:
return *lbuf >> 20;
158 int buf_size = avpkt->
size;
161 uint32_t header_version,
version = 0;
162 char creator[101] = { 0 };
163 char input_device[33] = { 0 };
166 int magic_num, endian;
168 int w,
h, bits_per_color, descriptor,
elements, packing;
169 int yuv, color_trc, color_spec;
170 int encoding, need_align = 0, unpadded_10bit = 0;
172 unsigned int rgbBuffer = 0;
175 if (avpkt->
size <= 1634) {
185 if (magic_num ==
AV_RL32(
"SDPX")) {
187 }
else if (magic_num ==
AV_RB32(
"SDPX")) {
200 header_version =
read32(&buf, 0);
201 if (header_version ==
MKTAG(
'V',
'1',
'.',
'0'))
203 if (header_version ==
MKTAG(
'V',
'2',
'.',
'0'))
210 buf = avpkt->
data + 660;
211 ret =
read32(&buf, endian);
212 if (ret != 0xFFFFFFFF) {
215 "not properly decode.\n");
219 buf = avpkt->
data + 0x304;
235 bits_per_color = buf[0];
237 packing =
read16(&buf, endian);
238 encoding =
read16(&buf, endian);
257 buf = avpkt->
data + 1724;
259 if(
i &&
i != 0xFFFFFFFF) {
261 if (q.
num > 0 && q.
den > 0)
269 buf = avpkt->
data + 1940;
271 if(
i &&
i != 0xFFFFFFFF) {
273 if (q.
num > 0 && q.
den > 0)
284 buf = avpkt->
data + 1920;
289 if (
i != 0xFFFFFFFF) {
292 sizeof(uint32_t) * 4);
296 tc_sd = (uint32_t*)tcside->
data;
308 buf = avpkt->
data + 1952;
311 buf = avpkt->
data + 1964;
314 if (
i != 0xFFFFFFFF && j != 0xFFFFFFFF) {
318 if (bits_per_color >= 1 &&
319 minCV == 0.0f && maxCV == ((1<<bits_per_color) - 1)) {
321 }
else if (bits_per_color >= 8 &&
322 minCV == (1 <<(bits_per_color - 4)) &&
323 maxCV == (235<<(bits_per_color - 8))) {
329 switch (descriptor) {
364 switch (bits_per_color) {
425 "%d to color_trc.\n", color_trc);
429 switch (color_spec) {
448 "%d to color_primaries.\n", color_spec);
453 switch (color_spec) {
472 "%d to colorspace.\n", color_spec);
499 switch (1000 * descriptor + 10 * bits_per_color + endian) {
603 1000 * descriptor + 10 * bits_per_color + endian);
617 input_device[32] =
'\0';
621 if (!memcmp(input_device,
"Scanity", 7) ||
622 !memcmp(creator,
"Lasergraphics Inc.", 18)) {
632 switch (bits_per_color) {
634 for (x = 0; x < avctx->
height; x++) {
635 uint16_t *dst[4] = {(uint16_t*)ptr[0],
639 int shift =
elements > 1 ? packing == 1 ? 22 : 20 : packing == 1 ? 2 : 0;
640 for (y = 0; y < avctx->
width; y++) {
643 &n_datum, endian,
shift);
646 &n_datum, endian,
shift);
649 &n_datum, endian,
shift);
652 &n_datum, endian,
shift);
656 &n_datum, endian,
shift);
665 for (x = 0; x < avctx->
height; x++) {
666 uint16_t *dst[4] = {(uint16_t*)ptr[0],
670 int shift = packing == 1 ? 4 : 0;
671 for (y = 0; y < avctx->
width; y++) {
707 for (y = 0; y < avctx->
height; y++) {
712 for (x = 0; x < avctx->
width; x++) {
736 for (x = 0; x < avctx->
height; x++) {
741 for (y = 0; y < avctx->
width; y++) {
Libavcodec external API header.
#define MKTAG(a, b, c, d)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static uint16_t read12in32(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big)
@ DPX_COL_SPEC_USER_DEFINED
@ DPX_COL_SPEC_UNSPECIFIED_VIDEO
@ DPX_COL_SPEC_ITU_R_624_4_PAL
@ DPX_COL_SPEC_ITU_R_601_525
@ DPX_COL_SPEC_ITU_R_601_625
@ DPX_COL_SPEC_PRINTING_DENSITY
@ DPX_COL_SPEC_ITU_R_709_4
static unsigned int read16(const uint8_t **ptr, int is_big)
@ DPX_TRC_UNSPECIFIED_VIDEO
@ DPX_TRC_ITU_R_624_4_PAL
@ DPX_TRC_PRINTING_DENSITY
static uint16_t read10in32_gray(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big, int shift)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static unsigned int read32(const uint8_t **ptr, int is_big)
static uint16_t read10in32(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big, int shift)
#define AV_NUM_DATA_POINTERS
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, buffer_size_t size)
Add a new side data to a frame.
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
#define av_fourcc2str(fourcc)
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.
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define AV_PIX_FMT_GBRAP12
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_JPEG
Full range content.
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GBRP12
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
@ AV_PIX_FMT_GBRPF32BE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_GBRPF32LE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
@ AV_PIX_FMT_GBRAPF32BE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
@ AV_PIX_FMT_GBRAPF32LE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GBRAP10
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
@ AVCOL_TRC_SMPTE170M
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
@ AVCOL_TRC_BT709
also ITU-R BT1361
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
static const ElemCat * elements[ELEMENT_COUNT]
static int shift(int a, int b)
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
enum AVColorSpace colorspace
YUV colorspace type.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
const char * name
Name of the codec implementation.
Structure to hold side data for an AVFrame.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVDictionary * metadata
metadata.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
This structure stores compressed data.
Rational number (pair of numerator and denominator).
char * av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field)
Get the timecode string from the SMPTE timecode format.
#define AV_TIMECODE_STR_SIZE
static const uint8_t offset[127][2]