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

Raw Video Decoder. More...

#include "avcodec.h"
#include "bswapdsp.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"
#include "raw.h"
#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  RawVideoContext
 

Macros

#define SCALE16(x, bits)
 
#define MKSCALE16(name, r16, w16)
 Scale buffer to 16 bits per coded sample resolution.
 

Functions

static av_cold int raw_init_decoder (AVCodecContext *avctx)
 
static void flip (AVCodecContext *avctx, AVFrame *frame)
 
static int raw_decode (AVCodecContext *avctx, AVFrame *frame, 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 FFCodec ff_rawvideo_decoder
 

Detailed Description

Raw Video Decoder.

Definition in file rawdec.c.

Macro Definition Documentation

◆ SCALE16

#define SCALE16 ( x,
bits )
Value:
(((x) << (16 - (bits))) | ((x) >> (2 * (bits) - 16)))
static const uint8_t bits[8]
Definition fastaudio.c:100

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 { \
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)); \
} \
} \
}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define sample
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition get_bits.h:337
#define SCALE16(x, bits)
Definition rawdec.c:140
const char * name
Definition qsvenc.c:142
main external API structure.
Definition avcodec.h:443

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()

◆ raw_decode()

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

Definition at line 165 of file rawdec.c.

Referenced by raw_decode().

◆ raw_close_decoder()

static av_cold int raw_close_decoder ( AVCodecContext * avctx)
static

Definition at line 465 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},
}
#define NULL
Definition coverity.c:32
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition opt.h:355
#define AV_OPT_FLAG_VIDEO_PARAM
Definition opt.h:357
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326

Definition at line 59 of file rawdec.c.

◆ rawdec_class

const AVClass rawdec_class
static
Initial value:
= {
.class_name = "rawdec",
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

Definition at line 64 of file rawdec.c.

◆ ff_rawvideo_decoder

const FFCodec ff_rawvideo_decoder
Initial value:
= {
.p.name = "rawvideo",
CODEC_LONG_NAME("raw video"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(RawVideoContext),
.p.priv_class = &rawdec_class,
.p.capabilities = AV_CODEC_CAP_PARAM_CHANGE,
}
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AV_CODEC_CAP_PARAM_CHANGE
Codec supports changed parameters at any point.
Definition codec.h:106
@ AV_CODEC_ID_RAWVIDEO
Definition codec_id.h:63
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold int raw_close_decoder(AVCodecContext *avctx)
Definition rawdec.c:465
static av_cold int raw_init_decoder(AVCodecContext *avctx)
Definition rawdec.c:70
static const AVClass rawdec_class
Definition rawdec.c:64
static int raw_decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition rawdec.c:165

Definition at line 474 of file rawdec.c.