46 s->bits_per_component =
desc->comp[0].depth;
47 s->num_components =
desc->nb_components;
91#define write16(p, value) write16_internal(s->big_endian, p, value)
92#define write32(p, value) write32_internal(s->big_endian, p, value)
98 const uint8_t *
src = pic->
data[0];
101 for (y = 0; y < avctx->
height; y++) {
102 for (x = 0; x < avctx->
width; x++) {
126 for (y = 0; y < avctx->
height; y++) {
127 for (x = 0; x < avctx->
width; x++) {
141 for (
i = 0;
i < 3;
i++)
149 const uint16_t *
src[3] = {(uint16_t*)pic->
data[0],
150 (uint16_t*)pic->
data[1],
151 (uint16_t*)pic->
data[2]};
153 pad = avctx->
width*6;
154 pad = (
FFALIGN(pad, 4) - pad) >> 1;
155 for (y = 0; y < avctx->
height; y++) {
156 for (x = 0; x < avctx->
width; x++) {
167 for (
i = 0;
i < 3;
i++,
dst += 2)
170 for (
i = 0;
i < pad;
i++,
dst += 2)
172 for (
i = 0;
i < 3;
i++)
181 int size, ret, need_align,
len;
183 int color_trc, color_spec;
185#define HEADER_SIZE 1664
186 if (
s->bits_per_component == 10)
188 else if (
s->bits_per_component == 12) {
196 len = avctx->
width *
s->num_components *
s->bits_per_component >> 3;
210 memcpy (buf + 8,
"V1.0", 4);
215 write32(buf + 660, 0xFFFFFFFF);
222 buf[800] =
s->descriptor;
244 buf[801] = color_trc;
263 buf[802] = color_spec;
265 buf[803] =
s->bits_per_component;
266 write16(buf + 804, (
s->bits_per_component == 10 ||
s->bits_per_component == 12) ?
274 switch(
s->bits_per_component) {
279 const uint8_t *
src =
frame->data[0];
282 for (j=0; j<avctx->
height; j++) {
284 memset(
dst +
len, 0, need_align);
290 (
const uint8_t**)
frame->data,
frame->linesize,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const FFCodec ff_dpx_encoder
static av_cold int encode_init(AVCodecContext *avctx)
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define CODEC_PIXFMTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
common internal and external API header
@ DPX_COL_SPEC_UNSPECIFIED_VIDEO
@ DPX_COL_SPEC_ITU_R_624_4_PAL
@ DPX_COL_SPEC_ITU_R_709_4
@ DPX_TRC_UNSPECIFIED_VIDEO
@ DPX_TRC_ITU_R_624_4_PAL
static void encode_gbrp10(AVCodecContext *avctx, const AVFrame *pic, uint8_t *dst)
#define write16(p, value)
static void encode_rgb48_10bit(AVCodecContext *avctx, const AVFrame *pic, uint8_t *dst)
static av_always_inline void write32_internal(int big_endian, void *p, int value)
static av_cold int encode_init(AVCodecContext *avctx)
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
static av_always_inline void write16_internal(int big_endian, void *p, int value)
#define write32(p, value)
static void encode_gbrp12(AVCodecContext *avctx, const AVFrame *pic, uint8_t *dst)
int(* init)(AVBSFContext *ctx)
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame, AVPacket *pkt)
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_image_copy_to_buffer(uint8_t *dst, int dst_size, const uint8_t *const src_data[4], const int src_linesize[4], enum AVPixelFormat pix_fmt, int width, int height, int align)
Copy image data from an image into a buffer.
Libavcodec version macros.
Macro definitions for various function/variable attributes.
#define MKBETAG(a, b, c, d)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ 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_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
@ 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_GRAY16LE
Y , 16bpp, little-endian.
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
@ 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
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
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 AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
int flags
AV_CODEC_FLAG_*.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
This structure stores compressed data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...