FFmpeg
Loading...
Searching...
No Matches
rw2.h
Go to the documentation of this file.
1/*
2 * Panasonic RW2 raw image decoder
3 * Copyright (c) 2026 Lynne <dev@lynne.ee>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef AVCODEC_RW2_H
23#define AVCODEC_RW2_H
24
25#include <stdint.h>
26
27#include "libavutil/frame.h"
28#include "libavutil/pixfmt.h"
29
30#include "vlc.h"
31
32#define RW2_MAX_STRIPES 5
33#define RW2_MAX_IFD0_ENTRIES 512 /* parser cap, sizes exif[] */
34#define RW2_JOINT_CATS 13 /* categories with a code per magnitude, 2^k each */
35#define RW2_MAX_CODES ((1 << RW2_JOINT_CATS) + 17)
36
37typedef struct RW2Stripe {
38 uint32_t offset; /* bytes, from the start of the file */
39 uint32_t size_bits;
40 uint32_t left;
41 uint32_t width;
42 uint32_t height;
43} RW2Stripe;
44
45/* Coding parameters, tags 0x39 - 0x41 */
46typedef struct RW2Coding {
47 uint32_t gamma_shift[6]; /* 0x39 */
48 uint16_t gamma_point[6]; /* 0x3A */
49 int datamax; /* 0x3B */
50 int initial[4]; /* 0x3C - 0x3F */
51 uint8_t code_len[17]; /* 0x40, Huffman code per magnitude category */
52 uint16_t code_val[17];
53 uint8_t code_shift[17]; /* 0x41, magnitude bits left out */
54} RW2Coding;
55
56/* IFD0 contents, RawFormat 8 */
57typedef struct RW2Header {
59 int border[4]; /* top, left, bottom, right */
60 int cfa;
61 int bpp;
64 int black[3];
65 int linearity[3];
66 int wb[3]; /* as-shot white balance levels */
67
69
72
73 /* Standard IFD0 tags kept verbatim for EXIF, gathered during the header
74 * walk, with the IFD0 offset and where the metadata ends (first preview) */
77 uint32_t exif_off;
79} RW2Header;
80
81typedef struct RW2Code {
82 uint8_t len;
83 uint16_t code;
84 int16_t sym;
85} RW2Code;
86
101
102#endif /* AVCODEC_RW2_H */
long long int64_t
Definition coverity.c:34
reference-counted frame API
pixel format definitions
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
#define RW2_MAX_STRIPES
Definition rw2.h:32
#define RW2_MAX_IFD0_ENTRIES
Definition rw2.h:33
#define RW2_MAX_CODES
Definition rw2.h:35
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
Definition rw2.h:81
int16_t sym
Definition rw2.h:84
uint8_t len
Definition rw2.h:82
uint16_t code
Definition rw2.h:83
uint32_t gamma_shift[6]
Definition rw2.h:47
uint16_t code_val[17]
Definition rw2.h:52
int initial[4]
Definition rw2.h:50
uint8_t code_shift[17]
Definition rw2.h:53
uint16_t gamma_point[6]
Definition rw2.h:48
int datamax
Definition rw2.h:49
uint8_t code_len[17]
Definition rw2.h:51
VLC vlc
Definition rw2.h:96
void * hwaccel_picture_private
Definition rw2.h:89
uint16_t gamma[1<< 16]
Definition rw2.h:98
AVFrame * frame
Definition rw2.h:88
int use_gamma
Definition rw2.h:99
enum AVPixelFormat pix_fmt
Definition rw2.h:90
RW2Header h
Definition rw2.h:92
const uint8_t * payload
Definition rw2.h:94
RW2Code codes[RW2_MAX_CODES]
Definition rw2.h:97
int bpp
Definition rw2.h:61
uint32_t exif_off
Definition rw2.h:77
uint8_t exif[RW2_MAX_IFD0_ENTRIES *12]
Definition rw2.h:75
int exif_count
Definition rw2.h:76
int orientation
Definition rw2.h:63
RW2Coding c
Definition rw2.h:68
int linearity[3]
Definition rw2.h:65
int border[4]
Definition rw2.h:59
int black[3]
Definition rw2.h:64
int wb[3]
Definition rw2.h:66
int raw_format
Definition rw2.h:62
int nb_stripes
Definition rw2.h:70
int raw_width
Definition rw2.h:58
RW2Stripe stripes[RW2_MAX_STRIPES]
Definition rw2.h:71
int raw_height
Definition rw2.h:58
int cfa
Definition rw2.h:60
int64_t exif_end
Definition rw2.h:78
uint32_t size_bits
Definition rw2.h:39
uint32_t width
Definition rw2.h:41
uint32_t offset
Definition rw2.h:38
uint32_t height
Definition rw2.h:42
uint32_t left
Definition rw2.h:40
Definition vlc.h:50