Go to the documentation of this file.
32 static unsigned int read16(
const uint8_t **ptr,
int is_big)
44 static unsigned int read32(
const uint8_t **ptr,
int is_big)
57 int *n_datum,
int is_big,
int shift)
64 *lbuf =
read32(ptr, is_big);
74 static uint16_t
read10in32(
const uint8_t **ptr, uint32_t *lbuf,
75 int *n_datum,
int is_big,
int shift)
80 *lbuf =
read32(ptr, is_big);
84 *lbuf = *lbuf << 10 | *lbuf >>
shift & 0x3FFFFF;
89 static uint16_t
read12in32(
const uint8_t **ptr, uint32_t *lbuf,
90 int *n_datum,
int is_big)
95 *lbuf =
read32(ptr, is_big);
100 case 7:
return *lbuf & 0xFFF;
101 case 6:
return (*lbuf >> 12) & 0xFFF;
103 uint32_t
c = *lbuf >> 24;
104 *lbuf =
read32(ptr, is_big);
108 case 4:
return (*lbuf >> 4) & 0xFFF;
109 case 3:
return (*lbuf >> 16) & 0xFFF;
111 uint32_t
c = *lbuf >> 28;
112 *lbuf =
read32(ptr, is_big);
116 case 1:
return (*lbuf >> 8) & 0xFFF;
117 default:
return *lbuf >> 20;
124 const uint8_t *buf = avpkt->
data;
125 int buf_size = avpkt->
size;
127 uint32_t header_version,
version = 0;
128 char creator[101] = { 0 };
129 char input_device[33] = { 0 };
132 int magic_num, endian;
134 int w,
h, bits_per_color, descriptor,
elements, packing;
135 int yuv, color_trc, color_spec;
136 int encoding, need_align = 0, unpadded_10bit = 0;
138 unsigned int rgbBuffer = 0;
141 if (avpkt->
size <= 1634) {
151 if (magic_num ==
AV_RL32(
"SDPX")) {
153 }
else if (magic_num ==
AV_RB32(
"SDPX")) {
166 header_version =
read32(&buf, 0);
167 if (header_version ==
MKTAG(
'V',
'1',
'.',
'0'))
169 if (header_version ==
MKTAG(
'V',
'2',
'.',
'0'))
176 buf = avpkt->
data + 660;
178 if (
ret != 0xFFFFFFFF) {
181 "not properly decode.\n");
185 buf = avpkt->
data + 0x304;
201 bits_per_color = buf[0];
203 packing =
read16(&buf, endian);
204 encoding =
read16(&buf, endian);
211 if (bits_per_color > 31)
226 buf = avpkt->
data + 1724;
228 if(
i &&
i != 0xFFFFFFFF) {
230 if (q.
num > 0 && q.
den > 0)
238 buf = avpkt->
data + 1940;
240 if(
i &&
i != 0xFFFFFFFF) {
242 if (q.
num > 0 && q.
den > 0)
253 buf = avpkt->
data + 1920;
258 if (
i != 0xFFFFFFFF) {
261 sizeof(uint32_t) * 4, &tcside);
266 tc_sd = (uint32_t*)tcside->
data;
279 buf = avpkt->
data + 1952;
282 buf = avpkt->
data + 1964;
285 if (
i != 0xFFFFFFFF && j != 0xFFFFFFFF) {
289 if (bits_per_color >= 1 &&
290 minCV == 0.0
f && maxCV == ((1
U<<bits_per_color) - 1)) {
292 }
else if (bits_per_color >= 8 &&
293 minCV == (1 <<(bits_per_color - 4)) &&
294 maxCV == (235<<(bits_per_color - 8))) {
300 switch (descriptor) {
335 switch (bits_per_color) {
396 "%d to color_trc.\n", color_trc);
400 switch (color_spec) {
419 "%d to color_primaries.\n", color_spec);
424 switch (color_spec) {
443 "%d to colorspace.\n", color_spec);
455 input_device[32] =
'\0';
459 if (!memcmp(input_device,
"Scanity", 7) ||
460 !memcmp(creator,
"Lasergraphics Inc.", 18)) {
461 if (bits_per_color == 10)
487 switch (1000 * descriptor + 10 * bits_per_color + endian) {
591 1000 * descriptor + 10 * bits_per_color + endian);
606 switch (bits_per_color) {
608 for (x = 0; x < avctx->
height; x++) {
609 uint16_t *
dst[4] = {(uint16_t*)ptr[0],
613 int shift =
elements > 1 ? packing == 1 ? 22 : 20 : packing == 1 ? 2 : 0;
614 for (y = 0; y < avctx->
width; y++) {
617 &n_datum, endian,
shift);
620 &n_datum, endian,
shift);
623 &n_datum, endian,
shift);
626 &n_datum, endian,
shift);
630 &n_datum, endian,
shift);
639 for (x = 0; x < avctx->
height; x++) {
640 uint16_t *
dst[4] = {(uint16_t*)ptr[0],
644 int shift = packing == 1 ? 4 : 0;
645 for (y = 0; y < avctx->
width; y++) {
681 for (y = 0; y < avctx->
height; y++) {
686 for (x = 0; x < avctx->
width; x++) {
710 for (x = 0; x < avctx->
height; x++) {
715 for (y = 0; y < avctx->
width; y++) {
@ DPX_COL_SPEC_ITU_R_624_4_PAL
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_TIMECODE_STR_SIZE
@ DPX_COL_SPEC_ITU_R_601_525
enum AVColorSpace colorspace
YUV colorspace type.
static const ElemCat * elements[ELEMENT_COUNT]
static int decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
This structure describes decoded (raw) audio or video data.
@ 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...
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
@ AV_PIX_FMT_GBRAPF32LE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
static uint16_t read10in32_gray(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big, int shift)
@ AVCOL_RANGE_JPEG
Full range content.
@ AV_PIX_FMT_GBRPF32BE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
#define AV_LOG_VERBOSE
Detailed information.
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
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.
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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.
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
AVCodec p
The public AVCodec.
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
#define AV_PIX_FMT_GBRP10
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
@ DPX_COL_SPEC_ITU_R_709_4
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_PIX_FMT_GBRAP10
#define FF_CODEC_DECODE_CB(func)
#define AV_PIX_FMT_GBRAP12
@ DPX_COL_SPEC_ITU_R_601_625
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
@ DPX_TRC_ITU_R_624_4_PAL
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
#define CODEC_LONG_NAME(str)
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
#define AV_PIX_FMT_GRAY10
@ AV_PIX_FMT_GBRAPF32BE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Rational number (pair of numerator and denominator).
@ 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...
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
@ 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...
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
const FFCodec ff_dpx_decoder
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static uint16_t read12in32(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
static int shift(int a, int b)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define AV_NUM_DATA_POINTERS
int ff_frame_new_side_data(const AVCodecContext *avctx, AVFrame *frame, enum AVFrameSideDataType type, size_t size, AVFrameSideData **psd)
Wrapper around av_frame_new_side_data, which rejects side data overridden by the demuxer.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
@ DPX_COL_SPEC_UNSPECIFIED_VIDEO
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
#define AV_LOG_INFO
Standard information.
@ AVCOL_TRC_BT709
also ITU-R BT1361
static unsigned int read16(const uint8_t **ptr, int is_big)
@ 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...
#define i(width, name, range_min, range_max)
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.
static uint16_t read10in32(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big, int shift)
#define AV_PIX_FMT_GBRP12
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AV_PIX_FMT_GBRPF32LE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
@ DPX_TRC_UNSPECIFIED_VIDEO
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
main external API structure.
AVDictionary * metadata
metadata.
@ AVCOL_TRC_SMPTE170M
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ DPX_COL_SPEC_USER_DEFINED
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Structure to hold side data for an AVFrame.
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
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.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
static unsigned int read32(const uint8_t **ptr, int is_big)
#define AV_PIX_FMT_GRAY12
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
#define av_fourcc2str(fourcc)