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

Ut Video decoder. More...

#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; \
}
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define VLC_BITS
Definition cfhd.h:103
#define CACHED_BITSTREAM_READER
Definition fraps.c:36
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:645
static int get_bits_left(GetBitContext *gb)
Definition get_bits.h:688
static int get_vlc_multi(GetBitContext *s, uint8_t *dst, av_unused const VLC_MULTI_ELEM *const Jtable, const VLCElem *const table, const int bits, const int max_depth, av_unused const int symbols_size)
Definition get_bits.h:660
#define fail
Definition test.h:479
#define b
Definition input.c:43
#define stride
#define width
Definition dsp.h:89
static double c[64]

Definition at line 117 of file utvideodec.c.

Referenced by decode_plane(), and decode_plane10().

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 141 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 228 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 238 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 377 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 429 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 484 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 525 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 580 of file utvideodec.c.

◆ decode_init()

static av_cold int decode_init ( AVCodecContext * avctx)
static

Definition at line 901 of file utvideodec.c.

◆ decode_end()

static av_cold int decode_end ( AVCodecContext * avctx)
static

Definition at line 1067 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),
}
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_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition codec.h:98
@ AV_CODEC_ID_UTVIDEO
Definition codec_id.h:203
@ 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 1077 of file utvideodec.c.