Go to the documentation of this file.
63 static unsigned int read16(
const uint8_t **ptr,
int is_big)
75 static unsigned int read32(
const uint8_t **ptr,
int is_big)
88 int *n_datum,
int is_big,
int shift)
95 *lbuf =
read32(ptr, is_big);
105 static uint16_t
read10in32(
const uint8_t **ptr, uint32_t *lbuf,
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;
120 static uint16_t
read12in32(
const uint8_t **ptr, uint32_t *lbuf,
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;
155 const uint8_t *buf = avpkt->
data;
156 int buf_size = avpkt->
size;
158 uint32_t header_version,
version = 0;
159 char creator[101] = { 0 };
160 char input_device[33] = { 0 };
163 int magic_num, endian;
165 int w,
h, bits_per_color, descriptor,
elements, packing;
166 int yuv, color_trc, color_spec;
167 int encoding, need_align = 0, unpadded_10bit = 0;
169 unsigned int rgbBuffer = 0;
172 if (avpkt->
size <= 1634) {
182 if (magic_num ==
AV_RL32(
"SDPX")) {
184 }
else if (magic_num ==
AV_RB32(
"SDPX")) {
197 header_version =
read32(&buf, 0);
198 if (header_version ==
MKTAG(
'V',
'1',
'.',
'0'))
200 if (header_version ==
MKTAG(
'V',
'2',
'.',
'0'))
207 buf = avpkt->
data + 660;
209 if (
ret != 0xFFFFFFFF) {
212 "not properly decode.\n");
216 buf = avpkt->
data + 0x304;
232 bits_per_color = buf[0];
234 packing =
read16(&buf, endian);
235 encoding =
read16(&buf, endian);
242 if (bits_per_color > 31)
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, &tcside);
297 tc_sd = (uint32_t*)tcside->
data;
310 buf = avpkt->
data + 1952;
313 buf = avpkt->
data + 1964;
316 if (
i != 0xFFFFFFFF && j != 0xFFFFFFFF) {
320 if (bits_per_color >= 1 &&
321 minCV == 0.0
f && maxCV == ((1
U<<bits_per_color) - 1)) {
323 }
else if (bits_per_color >= 8 &&
324 minCV == (1 <<(bits_per_color - 4)) &&
325 maxCV == (235<<(bits_per_color - 8))) {
331 switch (descriptor) {
366 switch (bits_per_color) {
427 "%d to color_trc.\n", color_trc);
431 switch (color_spec) {
450 "%d to color_primaries.\n", color_spec);
455 switch (color_spec) {
474 "%d to colorspace.\n", color_spec);
486 input_device[32] =
'\0';
490 if (!memcmp(input_device,
"Scanity", 7) ||
491 !memcmp(creator,
"Lasergraphics Inc.", 18)) {
492 if (bits_per_color == 10)
518 switch (1000 * descriptor + 10 * bits_per_color + endian) {
622 1000 * descriptor + 10 * bits_per_color + endian);
637 switch (bits_per_color) {
639 for (x = 0; x < avctx->
height; x++) {
640 uint16_t *
dst[4] = {(uint16_t*)ptr[0],
644 int shift =
elements > 1 ? packing == 1 ? 22 : 20 : packing == 1 ? 2 : 0;
645 for (y = 0; y < avctx->
width; y++) {
648 &n_datum, endian,
shift);
651 &n_datum, endian,
shift);
654 &n_datum, endian,
shift);
657 &n_datum, endian,
shift);
661 &n_datum, endian,
shift);
670 for (x = 0; x < avctx->
height; x++) {
671 uint16_t *
dst[4] = {(uint16_t*)ptr[0],
675 int shift = packing == 1 ? 4 : 0;
676 for (y = 0; y < avctx->
width; y++) {
712 for (y = 0; y < avctx->
height; y++) {
717 for (x = 0; x < avctx->
width; x++) {
741 for (x = 0; x < avctx->
height; x++) {
746 for (y = 0; y < avctx->
width; y++) {
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_TIMECODE_STR_SIZE
@ DPX_COL_SPEC_ITU_R_709_4
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.
@ DPX_COL_SPEC_USER_DEFINED
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.
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_TRC_PRINTING_DENSITY
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
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
@ DPX_COL_SPEC_PRINTING_DENSITY
@ 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)
@ DPX_TRC_ITU_R_624_4_PAL
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_ITU_R_601_625
@ DPX_TRC_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
@ DPX_COL_SPEC_UNSPECIFIED_VIDEO
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.
@ DPX_COL_SPEC_ITU_R_624_4_PAL
@ 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
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)
@ 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)
@ DPX_COL_SPEC_ITU_R_601_525