FFmpeg
Loading...
Searching...
No Matches
rw2dec.c File Reference

Panasonic RW2 decoder, RawFormat 8 only (S1II, S5II, GH6). More...

#include "libavutil/internal.h"
#include "libavutil/buffer.h"
#include "libavutil/mem.h"
#include "libavutil/raw_color_params.h"
#include "libavutil/reverse.h"
#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "exif.h"
#include "exif_internal.h"
#include "get_bits.h"
#include "hwaccel_internal.h"
#include "thread.h"
#include "tiff_common.h"
#include "rw2.h"

Go to the source code of this file.

Macros

#define BITSTREAM_READER_LE
 
#define CACHED_BITSTREAM_READER   1
 
#define RW2_VLC_BITS   11
 
#define RW2_JOINT_BITS   16 /* longest code with its magnitude folded in */
 
#define RW2_SYM_DELTA   0x2000 /* joint symbols: delta + RW2_SYM_DELTA */
 
#define RW2_SYM_ESC   0x4000 /* other categories: RW2_SYM_ESC + category */
 

Functions

static av_always_inline int get_delta (const RW2DecContext *s, GetBitContext *bc, int *delta)
 
static int gamma_curve (const RW2Coding *c, uint32_t v)
 
static int build_tables (RW2DecContext *s)
 
static int decode_stripe (AVCodecContext *avctx, void *tdata, int jobnr, int threadnr)
 
static int read_array_count (GetByteContext *gb, unsigned type, unsigned count, unsigned expected, int max)
 
static int parse_header (RW2Header *h, const uint8_t *data, int size)
 
static int check_stripes (AVCodecContext *avctx, const RW2Header *h, int payload_size)
 
static enum AVPixelFormat get_pixel_format (AVCodecContext *avctx, enum AVPixelFormat pix_fmt)
 
static int export_exif (AVCodecContext *avctx, AVFrame *frame, const uint8_t *data, int size)
 
static int export_metadata (AVCodecContext *avctx, AVFrame *frame, const uint8_t *hdr, int hdr_size)
 
static int decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
 
static av_cold int decode_init (AVCodecContext *avctx)
 
static av_cold int decode_end (AVCodecContext *avctx)
 

Variables

const FFCodec ff_rw2_decoder
 

Detailed Description

Panasonic RW2 decoder, RawFormat 8 only (S1II, S5II, GH6).

Bit-exact with LibRaw's pana8.cpp, quirks included.

Input is the whole file as one packet.

Definition in file rw2dec.c.

Macro Definition Documentation

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 36 of file rw2dec.c.

◆ CACHED_BITSTREAM_READER

#define CACHED_BITSTREAM_READER   1

Definition at line 37 of file rw2dec.c.

◆ RW2_VLC_BITS

#define RW2_VLC_BITS   11

Definition at line 51 of file rw2dec.c.

Referenced by build_tables(), and get_delta().

◆ RW2_JOINT_BITS

#define RW2_JOINT_BITS   16 /* longest code with its magnitude folded in */

Definition at line 52 of file rw2dec.c.

Referenced by build_tables().

◆ RW2_SYM_DELTA

#define RW2_SYM_DELTA   0x2000 /* joint symbols: delta + RW2_SYM_DELTA */

Definition at line 53 of file rw2dec.c.

Referenced by build_tables(), and get_delta().

◆ RW2_SYM_ESC

#define RW2_SYM_ESC   0x4000 /* other categories: RW2_SYM_ESC + category */

Definition at line 54 of file rw2dec.c.

Referenced by build_tables(), and get_delta().

Function Documentation

◆ get_delta()

static av_always_inline int get_delta ( const RW2DecContext * s,
GetBitContext * bc,
int * delta )
static

Definition at line 56 of file rw2dec.c.

Referenced by decode_stripe().

◆ gamma_curve()

static int gamma_curve ( const RW2Coding * c,
uint32_t v )
static

Definition at line 86 of file rw2dec.c.

Referenced by build_tables().

◆ build_tables()

static int build_tables ( RW2DecContext * s)
static

Definition at line 108 of file rw2dec.c.

Referenced by decode_frame().

◆ decode_stripe()

static int decode_stripe ( AVCodecContext * avctx,
void * tdata,
int jobnr,
int threadnr )
static

Definition at line 147 of file rw2dec.c.

Referenced by decode_frame().

◆ read_array_count()

static int read_array_count ( GetByteContext * gb,
unsigned type,
unsigned count,
unsigned expected,
int max )
static

Definition at line 202 of file rw2dec.c.

Referenced by parse_header().

◆ parse_header()

static int parse_header ( RW2Header * h,
const uint8_t * data,
int size )
static

Definition at line 213 of file rw2dec.c.

Referenced by decode_frame().

◆ check_stripes()

static int check_stripes ( AVCodecContext * avctx,
const RW2Header * h,
int payload_size )
static

Definition at line 349 of file rw2dec.c.

Referenced by decode_frame().

◆ get_pixel_format()

static enum AVPixelFormat get_pixel_format ( AVCodecContext * avctx,
enum AVPixelFormat pix_fmt )
static

Definition at line 377 of file rw2dec.c.

Referenced by decode_frame().

◆ export_exif()

static int export_exif ( AVCodecContext * avctx,
AVFrame * frame,
const uint8_t * data,
int size )
static

Definition at line 391 of file rw2dec.c.

Referenced by export_metadata().

◆ export_metadata()

static int export_metadata ( AVCodecContext * avctx,
AVFrame * frame,
const uint8_t * hdr,
int hdr_size )
static

Definition at line 420 of file rw2dec.c.

Referenced by decode_frame().

◆ decode_frame()

static int decode_frame ( AVCodecContext * avctx,
AVFrame * frame,
int * got_frame,
AVPacket * avpkt )
static

Definition at line 467 of file rw2dec.c.

◆ decode_init()

static av_cold int decode_init ( AVCodecContext * avctx)
static

Definition at line 588 of file rw2dec.c.

◆ decode_end()

static av_cold int decode_end ( AVCodecContext * avctx)
static

Definition at line 601 of file rw2dec.c.

Variable Documentation

◆ ff_rw2_decoder

const FFCodec ff_rw2_decoder
Initial value:
= {
.p.name = "rw2",
CODEC_LONG_NAME("Panasonic RW2"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_RW2,
.priv_data_size = sizeof(RW2DecContext),
UPDATE_THREAD_CONTEXT(update_thread_context),
.p.capabilities = AV_CODEC_CAP_DR1 |
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP |
}
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
#define UPDATE_THREAD_CONTEXT(func)
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters if all frames are skipped due to the skip_frame setting...
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition codec.h:102
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition codec.h:98
@ AV_CODEC_ID_RW2
Definition codec_id.h:328
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold int decode_init(AVCodecContext *avctx)
Definition 4xm.c:998
static av_cold int decode_end(AVCodecContext *avctx)
Definition 4xm.c:980
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
Definition 4xm.c:837

Definition at line 609 of file rw2dec.c.