Go to the documentation of this file.
35 #include "config_components.h"
37 static unsigned int read16(
const uint8_t **ptr,
int is_big)
49 static unsigned int read32(
const uint8_t **ptr,
int is_big)
62 int *n_datum,
int is_big,
int shift)
69 *lbuf =
read32(ptr, is_big);
79 static uint16_t
read10in32(
const uint8_t **ptr, uint32_t *lbuf,
80 int *n_datum,
int is_big,
int shift)
85 *lbuf =
read32(ptr, is_big);
89 *lbuf = *lbuf << 10 | *lbuf >>
shift & 0x3FFFFF;
94 static uint16_t
read12in32(
const uint8_t **ptr, uint32_t *lbuf,
95 int *n_datum,
int is_big)
100 *lbuf =
read32(ptr, is_big);
105 case 7:
return *lbuf & 0xFFF;
106 case 6:
return (*lbuf >> 12) & 0xFFF;
108 uint32_t
c = *lbuf >> 24;
109 *lbuf =
read32(ptr, is_big);
113 case 4:
return (*lbuf >> 4) & 0xFFF;
114 case 3:
return (*lbuf >> 16) & 0xFFF;
116 uint32_t
c = *lbuf >> 28;
117 *lbuf =
read32(ptr, is_big);
121 case 1:
return (*lbuf >> 8) & 0xFFF;
122 default:
return *lbuf >> 20;
133 unsigned int rgbBuffer = 0;
141 for (x = 0; x < avctx->
height; x++) {
142 uint16_t *
dst[4] = {(uint16_t*)ptr[0],
147 for (y = 0; y < avctx->
width; y++) {
150 &n_datum, endian,
shift);
153 &n_datum, endian,
shift);
156 &n_datum, endian,
shift);
159 &n_datum, endian,
shift);
163 &n_datum, endian,
shift);
168 ptr[
i] +=
p->linesize[
i];
172 for (x = 0; x < avctx->
height; x++) {
173 uint16_t *
dst[4] = {(uint16_t*)ptr[0],
178 for (y = 0; y < avctx->
width; y++) {
203 ptr[
i] +=
p->linesize[
i];
214 for (y = 0; y < avctx->
height; y++) {
215 ptr[0] =
p->data[0] + y *
p->linesize[0];
216 ptr[1] =
p->data[1] + y *
p->linesize[1];
217 ptr[2] =
p->data[2] + y *
p->linesize[2];
218 ptr[3] =
p->data[3] + y *
p->linesize[3];
219 for (x = 0; x < avctx->
width; x++) {
243 for (x = 0; x < avctx->
height; x++) {
244 ptr[0] =
p->data[0] + x *
p->linesize[0];
245 ptr[1] =
p->data[1] + x *
p->linesize[1];
246 ptr[2] =
p->data[2] + x *
p->linesize[2];
247 ptr[3] =
p->data[3] + x *
p->linesize[3];
248 for (y = 0; y < avctx->
width; y++) {
269 #if CONFIG_DPX_VULKAN_HWACCEL
285 const uint8_t *buf = avpkt->
data;
286 int buf_size = avpkt->
size;
287 uint32_t header_version,
version = 0;
288 char creator[101] = { 0 };
289 char input_device[33] = { 0 };
294 int w,
h, descriptor;
295 int yuv, color_trc, color_spec;
298 if (avpkt->
size <= 1634) {
308 if (magic_num ==
AV_RL32(
"SDPX")) {
310 }
else if (magic_num ==
AV_RB32(
"SDPX")) {
323 header_version =
read32(&buf, 0);
324 if (header_version ==
MKTAG(
'V',
'1',
'.',
'0'))
326 if (header_version ==
MKTAG(
'V',
'2',
'.',
'0'))
333 buf = avpkt->
data + 660;
335 if (
ret != 0xFFFFFFFF) {
338 "not properly decode.\n");
342 buf = avpkt->
data + 0x304;
382 buf = avpkt->
data + 1724;
384 if(
i &&
i != 0xFFFFFFFF) {
386 if (q.
num > 0 && q.
den > 0)
394 buf = avpkt->
data + 1940;
396 if(
i &&
i != 0xFFFFFFFF) {
398 if (q.
num > 0 && q.
den > 0)
409 buf = avpkt->
data + 1920;
414 if (
i != 0xFFFFFFFF) {
417 sizeof(uint32_t) * 4, &tcside);
422 tc_sd = (uint32_t*)tcside->
data;
435 buf = avpkt->
data + 1952;
438 buf = avpkt->
data + 1964;
441 if (
i != 0xFFFFFFFF && j != 0xFFFFFFFF) {
456 switch (descriptor) {
552 "%d to color_trc.\n", color_trc);
556 switch (color_spec) {
575 "%d to color_primaries.\n", color_spec);
580 switch (color_spec) {
599 "%d to colorspace.\n", color_spec);
611 input_device[32] =
'\0';
612 av_dict_set(&
p->metadata,
"Input Device", input_device, 0);
615 if (!memcmp(input_device,
"Scanity", 7) ||
616 !memcmp(creator,
"Lasergraphics Inc.", 18)) {
843 #if CONFIG_DPX_VULKAN_HWACCEL
@ DPX_COL_SPEC_ITU_R_624_4_PAL
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_TIMECODE_STR_SIZE
@ DPX_COL_SPEC_ITU_R_601_525
AVPixelFormat
Pixel format.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static enum AVPixelFormat get_pixel_format(AVCodecContext *avctx, enum AVPixelFormat pix_fmt)
enum AVColorSpace colorspace
YUV colorspace type.
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
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"
void * hwaccel_picture_private
@ 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.
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
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.
static av_cold int decode_init(AVCodecContext *avctx)
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define AV_PIX_FMT_GBRAP10
#define FF_CODEC_DECODE_CB(func)
int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, void **hwaccel_picture_private)
Allocate a hwaccel frame private data if the provided avctx uses a hwaccel method that needs it.
#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
static enum AVPixelFormat pix_fmt
static enum AVPixelFormat pix_fmts[]
@ 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
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
@ 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...
@ AV_PICTURE_TYPE_I
Intra.
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
#define UPDATE_THREAD_CONTEXT(func)
@ 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
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
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
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
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
static av_cold int decode_end(AVCodecContext *avctx)
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.
static const char * hwaccel
@ 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
#define HWACCEL_VULKAN(codec)
enum AVPixelFormat pix_fmt
main external API structure.
static const FFHWAccel * ffhwaccel(const AVHWAccel *codec)
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have update_thread_context() run it in the next thread. Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little speed gain at this point but it should work. Use ff_thread_get_buffer()(or ff_progress_frame_get_buffer() in case you have inter-frame dependencies and use the ProgressFrame API) to allocate frame buffers. Call ff_progress_frame_report() after some part of the current picture has decoded. A good place to put this is where draw_horiz_band() is called - add this if it isn 't called anywhere
@ AVCOL_TRC_SMPTE170M
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
@ 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.
static void unpack_frame(AVCodecContext *avctx, AVFrame *p, const uint8_t *buf, int elements, int endian)
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.
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)