Go to the documentation of this file.
56 static void float2rgbe(uint8_t *rgbe,
float red,
float green,
float blue)
61 v =
FFMAX3(red, green, blue);
64 rgbe[0] = rgbe[1] = rgbe[2] = rgbe[3] = 0;
66 v = frexpf(v, &e) * 256.f / v;
81 int run_count = 0, old_run_count = 0;
87 old_run_count = run_count;
89 while ((beg_run + run_count <
width) && (run_count < 127) &&
90 (
data[beg_run * 4] ==
data[(beg_run + run_count) * 4]))
94 if ((old_run_count > 1) && (old_run_count == beg_run - cur)) {
95 buf[0] = 128 + old_run_count;
96 buf[1] =
data[cur * 4];
101 while (cur < beg_run) {
102 int nonrun_count =
FFMIN(128, beg_run - cur);
103 buf[0] = nonrun_count;
104 bytestream_put_byte(
buffer, buf[0]);
105 for (
int n = 0; n < nonrun_count; n++)
106 bytestream_put_byte(
buffer,
data[(cur + n) * 4]);
111 buf[0] = 128 + run_count;
112 buf[1] =
data[beg_run * 4];
127 packet_size = avctx->
width * avctx->
height * 4LL + 1024LL;
142 for (
int y = 0; y < avctx->
height; y++) {
147 if (avctx->
width < 8 || avctx->
width > 0x7fff) {
148 for (
int x = 0; x < avctx->
width; x++) {
153 bytestream_put_byte(&buf, 2);
154 bytestream_put_byte(&buf, 2);
155 bytestream_put_byte(&buf, avctx->
width >> 8);
156 bytestream_put_byte(&buf, avctx->
width & 0xFF);
158 for (
int x = 0; x < avctx->
width; x++)
159 float2rgbe(
s->scanline + 4 * x, red[x], green[x], blue[x]);
160 for (
int p = 0; p < 4; p++)
161 rle(&buf,
s->scanline + p, avctx->
width);
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...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
This structure describes decoded (raw) audio or video data.
static void float2rgbe(uint8_t *rgbe, float red, float green, float blue)
static av_cold int hdr_encode_close(AVCodecContext *avctx)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVCodec p
The public AVCodec.
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
static av_cold int hdr_encode_init(AVCodecContext *avctx)
#define FF_CODEC_ENCODE_CB(func)
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
static int hdr_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
#define CODEC_LONG_NAME(str)
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_PIX_FMT_GBRPF32
int flags
A combination of AV_PKT_FLAG values.
const FFCodec ff_hdr_encoder
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
const char * name
Name of the codec implementation.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
static void bytestream_put_str(uint8_t **buf, const char *const line)
void * av_calloc(size_t nmemb, size_t size)
main external API structure.
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
This structure stores compressed data.
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...
@ AV_CODEC_ID_RADIANCE_HDR
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
static void rle(uint8_t **buffer, const uint8_t *data, int width)