FFmpeg
Data Structures | Macros | Functions | Variables
utvideodec.c File Reference
#include <inttypes.h>
#include <stdlib.h>
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "bswapdsp.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "get_bits.h"
#include "lossless_videodsp.h"
#include "thread.h"
#include "utvideo.h"
#include "utvideodsp.h"

Go to the source code of this file.

Data Structures

struct  UtvideoContext
 
struct  HuffEntry
 

Macros

#define CACHED_BITSTREAM_READER   !ARCH_X86_32
 
#define UNCHECKED_BITSTREAM_READER   1
 
#define VLC_BITS   11
 
#define READ_PLANE(b, end)
 

Functions

static int build_huff (UtvideoContext *c, const uint8_t *src, VLC *vlc, VLC_MULTI *multi, int *fsym, unsigned nb_elems)
 
static int decode_plane10 (UtvideoContext *c, int plane_no, uint16_t *dst, ptrdiff_t stride, int width, int height, const uint8_t *src, const uint8_t *huff, int use_pred)
 
static int compute_cmask (int plane_no, int interlaced, enum AVPixelFormat pix_fmt)
 
static int decode_plane (UtvideoContext *c, int plane_no, uint8_t *dst, ptrdiff_t stride, int width, int height, const uint8_t *src, int use_pred)
 
static void restore_median_planar (UtvideoContext *c, uint8_t *src, ptrdiff_t stride, int width, int height, int slices, int rmode)
 
static void restore_median_planar_il (UtvideoContext *c, uint8_t *src, ptrdiff_t stride, int width, int height, int slices, int rmode)
 
static void restore_gradient_planar (UtvideoContext *c, uint8_t *src, ptrdiff_t stride, int width, int height, int slices, int rmode)
 
static void restore_gradient_planar_il (UtvideoContext *c, uint8_t *src, ptrdiff_t stride, int width, int height, int slices, int rmode)
 
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_utvideo_decoder
 

Detailed Description

Ut Video decoder

Definition in file utvideodec.c.

Macro Definition Documentation

◆ CACHED_BITSTREAM_READER

#define CACHED_BITSTREAM_READER   !ARCH_X86_32

Definition at line 30 of file utvideodec.c.

◆ UNCHECKED_BITSTREAM_READER

#define UNCHECKED_BITSTREAM_READER   1

Definition at line 31 of file utvideodec.c.

◆ VLC_BITS

#define VLC_BITS   11

◆ READ_PLANE

#define READ_PLANE (   b,
  end 
)
Value:
{ \
buf = !use_pred ? dest : c->buffer; \
i = 0; \
for (; CACHED_BITSTREAM_READER && i < width-end && get_bits_left(&gb) > 0;) {\
ret = get_vlc_multi(&gb, (uint8_t *)buf + i * b, multi.table, \
vlc.table, VLC_BITS, 3, b); \
if (ret > 0) \
i += ret; \
if (ret <= 0) \
goto fail; \
} \
for (; i < width && get_bits_left(&gb) > 0; i++) \
buf[i] = get_vlc2(&gb, vlc.table, VLC_BITS, 3); \
if (use_pred) { \
if (b == 2) \
c->llviddsp.add_left_pred_int16((uint16_t *)dest, (const uint16_t *)buf, 0x3ff, width, prev); \
else \
c->llviddsp.add_left_pred((uint8_t *)dest, (const uint8_t *)buf, width, prev); \
} \
prev = dest[width-1]; \
dest += stride; \
}

Definition at line 118 of file utvideodec.c.

Function Documentation

◆ build_huff()

static int build_huff ( UtvideoContext c,
const uint8_t *  src,
VLC vlc,
VLC_MULTI multi,
int fsym,
unsigned  nb_elems 
)
static

Definition at line 76 of file utvideodec.c.

Referenced by decode_plane(), and decode_plane10().

◆ decode_plane10()

static int decode_plane10 ( UtvideoContext c,
int  plane_no,
uint16_t *  dst,
ptrdiff_t  stride,
int  width,
int  height,
const uint8_t *  src,
const uint8_t *  huff,
int  use_pred 
)
static

Definition at line 142 of file utvideodec.c.

Referenced by decode_frame().

◆ compute_cmask()

static int compute_cmask ( int  plane_no,
int  interlaced,
enum AVPixelFormat  pix_fmt 
)
static

Definition at line 229 of file utvideodec.c.

Referenced by decode_plane().

◆ decode_plane()

static int decode_plane ( UtvideoContext c,
int  plane_no,
uint8_t *  dst,
ptrdiff_t  stride,
int  width,
int  height,
const uint8_t *  src,
int  use_pred 
)
static

Definition at line 239 of file utvideodec.c.

Referenced by decode_frame().

◆ restore_median_planar()

static void restore_median_planar ( UtvideoContext c,
uint8_t *  src,
ptrdiff_t  stride,
int  width,
int  height,
int  slices,
int  rmode 
)
static

Definition at line 378 of file utvideodec.c.

Referenced by decode_frame().

◆ restore_median_planar_il()

static void restore_median_planar_il ( UtvideoContext c,
uint8_t *  src,
ptrdiff_t  stride,
int  width,
int  height,
int  slices,
int  rmode 
)
static

Definition at line 430 of file utvideodec.c.

Referenced by decode_frame().

◆ restore_gradient_planar()

static void restore_gradient_planar ( UtvideoContext c,
uint8_t *  src,
ptrdiff_t  stride,
int  width,
int  height,
int  slices,
int  rmode 
)
static

Definition at line 485 of file utvideodec.c.

Referenced by decode_frame().

◆ restore_gradient_planar_il()

static void restore_gradient_planar_il ( UtvideoContext c,
uint8_t *  src,
ptrdiff_t  stride,
int  width,
int  height,
int  slices,
int  rmode 
)
static

Definition at line 526 of file utvideodec.c.

Referenced by decode_frame().

◆ decode_frame()

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

Definition at line 581 of file utvideodec.c.

◆ decode_init()

static av_cold int decode_init ( AVCodecContext avctx)
static

Definition at line 904 of file utvideodec.c.

◆ decode_end()

static av_cold int decode_end ( AVCodecContext avctx)
static

Definition at line 1070 of file utvideodec.c.

Variable Documentation

◆ ff_utvideo_decoder

const FFCodec ff_utvideo_decoder
Initial value:
= {
.p.name = "utvideo",
CODEC_LONG_NAME("Ut Video"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(UtvideoContext),
.close = decode_end,
}

Definition at line 1080 of file utvideodec.c.

get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:695
decode_init
static av_cold int decode_init(AVCodecContext *avctx)
Definition: utvideodec.c:904
decode_end
static av_cold int decode_end(AVCodecContext *avctx)
Definition: utvideodec.c:1070
b
#define b
Definition: input.c:41
fail
#define fail()
Definition: checkasm.h:179
get_vlc_multi
static int get_vlc_multi(GetBitContext *s, uint8_t *dst, const VLC_MULTI_ELEM *const Jtable, const VLCElem *const table, const int bits, const int max_depth, const int symbols_size)
Definition: get_bits.h:667
width
#define width
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:286
AV_CODEC_ID_UTVIDEO
@ AV_CODEC_ID_UTVIDEO
Definition: codec_id.h:205
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:271
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:110
get_vlc2
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:652
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
decode_frame
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition: utvideodec.c:581
VLC_BITS
#define VLC_BITS
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
UtvideoContext
Definition: utvideodec.c:46
stride
#define stride
Definition: h264pred_template.c:537
ret
ret
Definition: filter_design.txt:187
CACHED_BITSTREAM_READER
#define CACHED_BITSTREAM_READER
Definition: utvideodec.c:30
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201