37 c = bytestream2_get_byte(gb);
50 const float v =
val / 256.f;
63 scanline[0] = bytestream2_get_byte(gb);
64 scanline[1] = bytestream2_get_byte(gb);
65 scanline[2] = bytestream2_get_byte(gb);
66 scanline[3] = bytestream2_get_byte(gb);
68 if (scanline[0] == 1 &&
71 int run = scanline[3];
72 for (
int i =
run << rshift;
i > 0 &&
w > 0 && scanline >= start + 4;
i--) {
73 memcpy(scanline, scanline - 4, 4);
101 if (memcmp(
"#?RADIANCE\n",
line, 11) && memcmp(
"#?RGBE\n",
line, 7))
106 if (sscanf(
line,
"PIXASPECT=%f\n", &sar) == 1)
108 }
while (
line[0] !=
'\n' &&
line[0]);
143 for (
int y = 0; y <
height; y++) {
144 float *dst_r = (
float *)(p->data[2] + y * p->linesize[2]);
145 float *dst_g = (
float *)(p->data[0] + y * p->linesize[0]);
146 float *dst_b = (
float *)(p->data[1] + y * p->linesize[1]);
147 uint8_t *scanline = p->data[0] + y * p->linesize[0];
157 i = bytestream2_peek_byte(&gb);
166 scanline[1] = bytestream2_get_byte(&gb);
167 scanline[2] = bytestream2_get_byte(&gb);
168 i = bytestream2_get_byte(&gb);
170 if (scanline[1] != 2 || scanline[2] & 128) {
179 for (
int i = 0;
i < 4;
i++) {
180 uint8_t *scanline = p->data[0] + y * p->linesize[0] +
i;
183 int run = bytestream2_get_byte(&gb);
185 uint8_t
val = bytestream2_get_byte(&gb);
193 }
else if (
run > 0) {
197 scanline[j] = bytestream2_get_byte(&gb);
205 for (
int x = 0; x <
width; x++) {
209 memcpy(rgbe, p->data[0] + y * p->linesize[0] + x * 4, 4);
210 expo = rgbe[3] - 128;
212 dst_r[x] =
convert(expo, rgbe[0]);
213 dst_b[x] =
convert(expo, rgbe[2]);
214 dst_g[x] =
convert(expo, rgbe[1]);
static double val(void *priv, double ch)
const FFCodec ff_hdr_decoder
Libavcodec external API header.
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define i(width, name, range_min, range_max)
#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)
int ff_set_dimensions(AVCodecContext *s, int width, int height)
static void convert(float y, float u, float v, float *b, float *g, float *r)
#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.
@ AV_CODEC_ID_RADIANCE_HDR
@ AVDISCARD_ALL
discard all
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
static int decompress(uint8_t *scanline, int w, GetByteContext *gb, const uint8_t *start)
static float convert(int expo, int val)
static int hdr_get_line(GetByteContext *gb, uint8_t *buffer, int size)
Multithreading API for decoders.
#define AV_PIX_FMT_GBRPF32
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
enum AVDiscard skip_frame
Skip decoding for selected frames.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.