FFmpeg
Loading...
Searching...
No Matches
libavcodec
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
37
typedef
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 */
46
typedef
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 */
57
typedef
struct
RW2Header
{
58
int
raw_width
,
raw_height
;
59
int
border
[4];
/* top, left, bottom, right */
60
int
cfa
;
61
int
bpp
;
62
int
raw_format
;
63
int
orientation
;
64
int
black
[3];
65
int
linearity
[3];
66
int
wb
[3];
/* as-shot white balance levels */
67
68
RW2Coding
c
;
69
70
int
nb_stripes
;
71
RW2Stripe
stripes
[
RW2_MAX_STRIPES
];
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) */
75
uint8_t
exif
[
RW2_MAX_IFD0_ENTRIES
* 12];
76
int
exif_count
;
77
uint32_t
exif_off
;
78
int64_t
exif_end
;
79
}
RW2Header
;
80
81
typedef
struct
RW2Code
{
82
uint8_t
len
;
83
uint16_t
code
;
84
int16_t
sym
;
85
}
RW2Code
;
86
87
typedef
struct
RW2DecContext
{
88
AVFrame
*
frame
;
89
void
*
hwaccel_picture_private
;
90
enum
AVPixelFormat
pix_fmt
;
91
92
RW2Header
h
;
93
94
const
uint8_t *
payload
;
95
96
VLC
vlc
;
97
RW2Code
codes
[
RW2_MAX_CODES
];
98
uint16_t
gamma
[1 << 16];
99
int
use_gamma
;
100
}
RW2DecContext
;
101
102
#endif
/* AVCODEC_RW2_H */
int64_t
long long int64_t
Definition
coverity.c:34
frame.h
reference-counted frame API
pixfmt.h
pixel format definitions
AVPixelFormat
AVPixelFormat
Pixel format.
Definition
pixfmt.h:71
RW2_MAX_STRIPES
#define RW2_MAX_STRIPES
Definition
rw2.h:32
RW2_MAX_IFD0_ENTRIES
#define RW2_MAX_IFD0_ENTRIES
Definition
rw2.h:33
RW2_MAX_CODES
#define RW2_MAX_CODES
Definition
rw2.h:35
AVFrame
This structure describes decoded (raw) audio or video data.
Definition
frame.h:479
RW2Code
Definition
rw2.h:81
RW2Code::sym
int16_t sym
Definition
rw2.h:84
RW2Code::len
uint8_t len
Definition
rw2.h:82
RW2Code::code
uint16_t code
Definition
rw2.h:83
RW2Coding
Definition
rw2.h:46
RW2Coding::gamma_shift
uint32_t gamma_shift[6]
Definition
rw2.h:47
RW2Coding::code_val
uint16_t code_val[17]
Definition
rw2.h:52
RW2Coding::initial
int initial[4]
Definition
rw2.h:50
RW2Coding::code_shift
uint8_t code_shift[17]
Definition
rw2.h:53
RW2Coding::gamma_point
uint16_t gamma_point[6]
Definition
rw2.h:48
RW2Coding::datamax
int datamax
Definition
rw2.h:49
RW2Coding::code_len
uint8_t code_len[17]
Definition
rw2.h:51
RW2DecContext
Definition
rw2.h:87
RW2DecContext::vlc
VLC vlc
Definition
rw2.h:96
RW2DecContext::hwaccel_picture_private
void * hwaccel_picture_private
Definition
rw2.h:89
RW2DecContext::gamma
uint16_t gamma[1<< 16]
Definition
rw2.h:98
RW2DecContext::frame
AVFrame * frame
Definition
rw2.h:88
RW2DecContext::use_gamma
int use_gamma
Definition
rw2.h:99
RW2DecContext::pix_fmt
enum AVPixelFormat pix_fmt
Definition
rw2.h:90
RW2DecContext::h
RW2Header h
Definition
rw2.h:92
RW2DecContext::payload
const uint8_t * payload
Definition
rw2.h:94
RW2DecContext::codes
RW2Code codes[RW2_MAX_CODES]
Definition
rw2.h:97
RW2Header
Definition
rw2.h:57
RW2Header::bpp
int bpp
Definition
rw2.h:61
RW2Header::exif_off
uint32_t exif_off
Definition
rw2.h:77
RW2Header::exif
uint8_t exif[RW2_MAX_IFD0_ENTRIES *12]
Definition
rw2.h:75
RW2Header::exif_count
int exif_count
Definition
rw2.h:76
RW2Header::orientation
int orientation
Definition
rw2.h:63
RW2Header::c
RW2Coding c
Definition
rw2.h:68
RW2Header::linearity
int linearity[3]
Definition
rw2.h:65
RW2Header::border
int border[4]
Definition
rw2.h:59
RW2Header::black
int black[3]
Definition
rw2.h:64
RW2Header::wb
int wb[3]
Definition
rw2.h:66
RW2Header::raw_format
int raw_format
Definition
rw2.h:62
RW2Header::nb_stripes
int nb_stripes
Definition
rw2.h:70
RW2Header::raw_width
int raw_width
Definition
rw2.h:58
RW2Header::stripes
RW2Stripe stripes[RW2_MAX_STRIPES]
Definition
rw2.h:71
RW2Header::raw_height
int raw_height
Definition
rw2.h:58
RW2Header::cfa
int cfa
Definition
rw2.h:60
RW2Header::exif_end
int64_t exif_end
Definition
rw2.h:78
RW2Stripe
Definition
rw2.h:37
RW2Stripe::size_bits
uint32_t size_bits
Definition
rw2.h:39
RW2Stripe::width
uint32_t width
Definition
rw2.h:41
RW2Stripe::offset
uint32_t offset
Definition
rw2.h:38
RW2Stripe::height
uint32_t height
Definition
rw2.h:42
RW2Stripe::left
uint32_t left
Definition
rw2.h:40
VLC
Definition
vlc.h:50
vlc.h
Generated on Thu Oct 8 2026 19:21:00 for FFmpeg by
1.13.2