FFmpeg
Data Structures | Macros | Functions | Variables
rawdec.c File Reference
#include "avcodec.h"
#include "bswapdsp.h"
#include "decode.h"
#include "get_bits.h"
#include "internal.h"
#include "raw.h"
#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  RawVideoContext
 

Macros

#define SCALE16(x, bits)   (((x) << (16 - (bits))) | ((x) >> (2 * (bits) - 16)))
 
#define MKSCALE16(name, r16, w16)
 Scale buffer to 16 bits per coded sample resolution. More...
 

Functions

static av_cold int raw_init_decoder (AVCodecContext *avctx)
 
static void flip (AVCodecContext *avctx, AVFrame *frame)
 
static int raw_decode (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int raw_close_decoder (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass rawdec_class
 
const AVCodec ff_rawvideo_decoder
 

Detailed Description

Raw Video Decoder

Definition in file rawdec.c.

Macro Definition Documentation

◆ SCALE16

#define SCALE16 (   x,
  bits 
)    (((x) << (16 - (bits))) | ((x) >> (2 * (bits) - 16)))

Definition at line 140 of file rawdec.c.

◆ MKSCALE16

#define MKSCALE16 (   name,
  r16,
  w16 
)
Value:
static void name(AVCodecContext *avctx, uint8_t * dst, const uint8_t *buf, int buf_size, int packed) \
{ \
int i; \
if (!packed) { \
for (i = 0; i + 1 < buf_size; i += 2) \
w16(dst + i, SCALE16(r16(buf + i), avctx->bits_per_coded_sample)); \
} else { \
GetBitContext gb; \
init_get_bits(&gb, buf, buf_size * 8); \
for (i = 0; i < avctx->width * avctx->height; i++) { \
int sample = get_bits(&gb, avctx->bits_per_coded_sample); \
w16(dst + i*2, SCALE16(sample, avctx->bits_per_coded_sample)); \
} \
} \
}

Scale buffer to 16 bits per coded sample resolution.

Definition at line 145 of file rawdec.c.

Function Documentation

◆ raw_init_decoder()

static av_cold int raw_init_decoder ( AVCodecContext avctx)
static

Definition at line 70 of file rawdec.c.

◆ flip()

static void flip ( AVCodecContext avctx,
AVFrame frame 
)
static

◆ raw_decode()

static int raw_decode ( AVCodecContext avctx,
void *  data,
int got_frame,
AVPacket avpkt 
)
static

Definition at line 165 of file rawdec.c.

◆ raw_close_decoder()

static av_cold int raw_close_decoder ( AVCodecContext avctx)
static

Definition at line 475 of file rawdec.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
={
{"top", "top field first", 0x42, AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM|AV_OPT_FLAG_VIDEO_PARAM},
}

Definition at line 59 of file rawdec.c.

◆ rawdec_class

const AVClass rawdec_class
static
Initial value:
= {
.class_name = "rawdec",
.option = options,
}

Definition at line 64 of file rawdec.c.

◆ ff_rawvideo_decoder

const AVCodec ff_rawvideo_decoder
Initial value:
= {
.name = "rawvideo",
.long_name = NULL_IF_CONFIG_SMALL("raw video"),
.priv_data_size = sizeof(RawVideoContext),
.priv_class = &rawdec_class,
.capabilities = AV_CODEC_CAP_PARAM_CHANGE,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
}

Definition at line 484 of file rawdec.c.

raw_init_decoder
static av_cold int raw_init_decoder(AVCodecContext *avctx)
Definition: rawdec.c:70
FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:42
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
AV_OPT_FLAG_VIDEO_PARAM
#define AV_OPT_FLAG_VIDEO_PARAM
Definition: opt.h:280
AV_CODEC_ID_RAWVIDEO
@ AV_CODEC_ID_RAWVIDEO
Definition: codec_id.h:63
init
static int init
Definition: av_tx.c:47
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:380
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
options
static const AVOption options[]
Definition: rawdec.c:59
SCALE16
#define SCALE16(x, bits)
Definition: rawdec.c:140
RawVideoContext
Definition: rawdec.c:40
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
sample
#define sample
Definition: flacdsp_template.c:44
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
raw_decode
static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: rawdec.c:165
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:278
raw_close_decoder
static av_cold int raw_close_decoder(AVCodecContext *avctx)
Definition: rawdec.c:475
AVCodecContext
main external API structure.
Definition: avcodec.h:383
rawdec_class
static const AVClass rawdec_class
Definition: rawdec.c:64
AV_CODEC_CAP_PARAM_CHANGE
#define AV_CODEC_CAP_PARAM_CHANGE
Codec supports changed parameters at any point.
Definition: codec.h:121
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:241