36#include "config_components.h"
38static unsigned int read16(
const uint8_t **ptr,
int is_big)
50static unsigned int read32(
const uint8_t **ptr,
int is_big)
63 int *n_datum,
int is_big,
int shift)
70 *lbuf =
read32(ptr, is_big);
80static uint16_t
read10in32(
const uint8_t **ptr, uint32_t *lbuf,
81 int *n_datum,
int is_big,
int shift)
86 *lbuf =
read32(ptr, is_big);
90 *lbuf = *lbuf << 10 | *lbuf >>
shift & 0x3FFFFF;
95static uint16_t
read12in32(
const uint8_t **ptr, uint32_t *lbuf,
96 int *n_datum,
int is_big)
101 *lbuf =
read32(ptr, is_big);
106 case 7:
return *lbuf & 0xFFF;
107 case 6:
return (*lbuf >> 12) & 0xFFF;
109 uint32_t
c = *lbuf >> 24;
110 *lbuf =
read32(ptr, is_big);
114 case 4:
return (*lbuf >> 4) & 0xFFF;
115 case 3:
return (*lbuf >> 16) & 0xFFF;
117 uint32_t
c = *lbuf >> 28;
118 *lbuf =
read32(ptr, is_big);
122 case 1:
return (*lbuf >> 8) & 0xFFF;
123 default:
return *lbuf >> 20;
134 unsigned int rgbBuffer = 0;
142 for (x = 0; x < avctx->
height; x++) {
143 uint16_t *
dst[4] = {(uint16_t*)ptr[0],
148 for (y = 0; y < avctx->
width; y++) {
151 &n_datum, endian,
shift);
154 &n_datum, endian,
shift);
157 &n_datum, endian,
shift);
160 &n_datum, endian,
shift);
164 &n_datum, endian,
shift);
169 ptr[
i] += p->linesize[
i];
173 for (x = 0; x < avctx->
height; x++) {
174 uint16_t *
dst[4] = {(uint16_t*)ptr[0],
179 for (y = 0; y < avctx->
width; y++) {
204 ptr[
i] += p->linesize[
i];
215 for (y = 0; y < avctx->
height; y++) {
216 ptr[0] = p->data[0] + y * p->linesize[0];
217 ptr[1] = p->data[1] + y * p->linesize[1];
218 ptr[2] = p->data[2] + y * p->linesize[2];
219 ptr[3] = p->data[3] + y * p->linesize[3];
220 for (x = 0; x < avctx->
width; x++) {
245 for (x = 0; x < avctx->
height; x++) {
246 ptr[0] = p->data[0] + x * p->linesize[0];
247 ptr[1] = p->data[1] + x * p->linesize[1];
248 ptr[2] = p->data[2] + x * p->linesize[2];
249 ptr[3] = p->data[3] + x * p->linesize[3];
250 for (y = 0; y < avctx->
width; y++) {
271#if CONFIG_DPX_VULKAN_HWACCEL
287 const uint8_t *buf = avpkt->
data;
288 int buf_size = avpkt->
size;
289 uint32_t header_version,
version = 0;
290 char creator[101] = { 0 };
291 char input_device[33] = { 0 };
296 int w,
h, descriptor;
297 int yuv, color_trc, color_spec;
300 if (avpkt->
size <= 1634) {
310 if (magic_num ==
AV_RL32(
"SDPX")) {
312 }
else if (magic_num ==
AV_RB32(
"SDPX")) {
325 header_version =
read32(&buf, 0);
326 if (header_version ==
MKTAG(
'V',
'1',
'.',
'0'))
328 if (header_version ==
MKTAG(
'V',
'2',
'.',
'0'))
335 buf = avpkt->
data + 660;
337 if (ret != 0xFFFFFFFF) {
340 "not properly decode.\n");
344 buf = avpkt->
data + 0x304;
384 buf = avpkt->
data + 1724;
386 if(
i &&
i != 0xFFFFFFFF) {
388 if (q.
num > 0 && q.
den > 0)
396 buf = avpkt->
data + 1940;
398 if(
i &&
i != 0xFFFFFFFF) {
400 if (q.
num > 0 && q.
den > 0)
411 buf = avpkt->
data + 1920;
416 if (
i != 0xFFFFFFFF) {
419 sizeof(uint32_t) * 4, &tcside);
424 tc_sd = (uint32_t*)tcside->
data;
437 buf = avpkt->
data + 1952;
440 buf = avpkt->
data + 1964;
443 if (
i != 0xFFFFFFFF && j != 0xFFFFFFFF) {
458 switch (descriptor) {
554 "%d to color_trc.\n", color_trc);
558 switch (color_spec) {
577 "%d to color_primaries.\n", color_spec);
582 switch (color_spec) {
601 "%d to colorspace.\n", color_spec);
613 input_device[32] =
'\0';
614 av_dict_set(&p->metadata,
"Input Device", input_device, 0);
618 if (!memcmp(input_device,
"Scanity", 7) ||
619 !memcmp(creator,
"Lasergraphics Inc.", 18)) {
789 ret =
hwaccel->end_frame(avctx);
846#if CONFIG_DPX_VULKAN_HWACCEL
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const FFCodec ff_dpx_decoder
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define UPDATE_THREAD_CONTEXT(func)
#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...
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
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.
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.
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)
static enum AVPixelFormat pix_fmt
static void unpack_frame(AVCodecContext *avctx, AVFrame *p, const uint8_t *buf, int elements, int endian)
static uint16_t read12in32(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big)
static enum AVPixelFormat get_pixel_format(AVCodecContext *avctx, enum AVPixelFormat pix_fmt)
static av_cold int decode_init(AVCodecContext *avctx)
static av_cold int decode_end(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
static unsigned int read16(const uint8_t **ptr, int is_big)
static uint16_t read10in32_gray(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big, int shift)
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)
@ 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_ITU_R_709_4
@ DPX_TRC_UNSPECIFIED_VIDEO
@ DPX_TRC_ITU_R_624_4_PAL
static const char * hwaccel
#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.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
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.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
@ 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.
@ AV_PICTURE_TYPE_I
Intra.
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 const FFHWAccel * ffhwaccel(const AVHWAccel *codec)
#define HWACCEL_VULKAN(codec)
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
static av_cold int decode_init(AVCodecContext *avctx)
static av_cold int decode_end(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
static int shift(int a, int b)
Multithreading API for decoders.
Macro definitions for various function/variable attributes.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static enum AVPixelFormat pix_fmts[]
#define MKTAG(a, b, c, d)
#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
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
@ 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 RP 177 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 / derived in SMPTE RP 177 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), YZX and ST 428-1
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
static const ElemCat * elements[ELEMENT_COUNT]
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.
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
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.
Structure to hold side data for an AVFrame.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
Rational number (pair of numerator and denominator).
void * hwaccel_picture_private
enum AVPixelFormat pix_fmt
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