22 #include "libavutil/common.h"
23 #include "libavutil/intreadwrite.h"
24 #include "libavutil/imgutils.h"
76 #define write16(p, value) \
78 if (s->big_endian) AV_WB16(p, value); \
79 else AV_WL16(p, value); \
82 #define write32(p, value) \
84 if (s->big_endian) AV_WB32(p, value); \
85 else AV_WL32(p, value); \
94 for (y = 0; y < avctx->
height; y++) {
95 for (x = 0; x < avctx->
width; x++) {
98 value = ((
AV_RB16(src + 6*x + 4) & 0xFFC0
U) >> 4)
99 | ((
AV_RB16(src + 6*x + 2) & 0xFFC0
U) << 6)
100 | ((
AV_RB16(src + 6*x + 0) & 0xFFC0
U) << 16);
102 value = ((
AV_RL16(src + 6*x + 4) & 0xFFC0
U) >> 4)
103 | ((
AV_RL16(src + 6*x + 2) & 0xFFC0
U) << 6)
104 | ((
AV_RL16(src + 6*x + 0) & 0xFFC0
U) << 16);
119 for (y = 0; y < avctx->
height; y++) {
120 for (x = 0; x < avctx->
width; x++) {
123 value = (
AV_RB16(src[0] + 2*x) << 12)
125 | ((
unsigned)
AV_RB16(src[2] + 2*x) << 22);
127 value = (
AV_RL16(src[0] + 2*x) << 12)
129 | ((
unsigned)
AV_RL16(src[2] + 2*x) << 22);
134 for (i = 0; i < 3; i++)
142 const uint16_t *
src[3] = {(uint16_t*)pic->
data[0],
143 (uint16_t*)pic->
data[1],
144 (uint16_t*)pic->
data[2]};
146 for (y = 0; y < avctx->
height; y++) {
147 for (x = 0; x < avctx->
width; x++) {
150 value[1] =
AV_RB16(src[0] + x) << 4;
151 value[2] =
AV_RB16(src[1] + x) << 4;
152 value[0] =
AV_RB16(src[2] + x) << 4;
154 value[1] =
AV_RL16(src[0] + x) << 4;
155 value[2] =
AV_RL16(src[1] + x) << 4;
156 value[0] =
AV_RL16(src[2] + x) << 4;
158 for (i = 0; i < 3; i++)
161 for (i = 0; i < 3; i++)
173 #define HEADER_SIZE 1664
187 memcpy (buf + 8,
"V1.0", 4);
192 write32(buf + 660, 0xFFFFFFFF);
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and/or allocate data.
#define write32(p, value)
This structure describes decoded (raw) audio or video data.
int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
static av_cold int init(AVCodecContext *avctx)
packed RGB 8:8:8, 24bpp, RGBRGB...
static av_cold int encode_init(AVCodecContext *avctx)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height, unsigned char *dest, int dest_size)
Copy pixel data from an AVPicture into a buffer.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
static void encode_gbrp10(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst)
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
static void encode_gbrp12(AVCodecContext *avctx, const AVPicture *pic, uint16_t *dst)
const char * name
Name of the codec implementation.
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
#define CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointers to the image data planes
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
uint16_t depth_minus1
number of bits in the component minus 1
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Libavcodec external API header.
AVPixelFormat
Pixel format.
int flags
A combination of AV_PKT_FLAG values.
int width
picture width / height.
planar GBR 4:4:4 36bpp, little-endian
int AC3_NAME() encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_LOG_INFO
Standard information.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
planar GBR 4:4:4 36bpp, big-endian
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst)
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
#define MKBETAG(a, b, c, d)
planar GBR 4:4:4 30bpp, big-endian
Y , 16bpp, little-endian.
common internal api header.
#define write16(p, value)
int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height)
Calculate the size in bytes that a picture of the given width and height would occupy if stored in th...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
planar GBR 4:4:4 30bpp, little-endian
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
This structure stores compressed data.
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...