FFmpeg
Loading...
Searching...
No Matches
magicyuv.c File Reference
#include <stdlib.h>
#include <string.h>
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"
#include "lossless_videodsp.h"
#include "thread.h"

Go to the source code of this file.

Data Structures

struct  Slice
 
struct  HuffEntry
 
struct  MagicYUVContext
 

Macros

#define CACHED_BITSTREAM_READER   !ARCH_X86_32
 
#define VLC_BITS   12
 
#define READ_PLANE(dst, plane, b, c)
 

Enumerations

enum  Prediction { LEFT = 1 , GRADIENT , MEDIAN }
 

Functions

static int huff_build (AVCodecContext *avctx, const uint8_t len[], uint16_t codes_pos[33], VLC *vlc, VLC_MULTI *multi, int nb_elems, void *logctx)
 
static void magicyuv_median_pred16 (uint16_t *dst, const uint16_t *src1, const uint16_t *diff, intptr_t w, int *left, int *left_top, int max)
 
static int magy_decode_slice10 (AVCodecContext *avctx, void *tdata, int j, int threadnr)
 
static int magy_decode_slice (AVCodecContext *avctx, void *tdata, int j, int threadnr)
 
static int build_huffman (AVCodecContext *avctx, const uint8_t *table, int table_size, int max)
 
static int magy_decode_frame (AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
 
static av_cold int magy_decode_init (AVCodecContext *avctx)
 
static av_cold int magy_decode_end (AVCodecContext *avctx)
 

Variables

const FFCodec ff_magicyuv_decoder
 

Macro Definition Documentation

◆ CACHED_BITSTREAM_READER

#define CACHED_BITSTREAM_READER   !ARCH_X86_32

Definition at line 25 of file magicyuv.c.

◆ VLC_BITS

#define VLC_BITS   12

Definition at line 38 of file magicyuv.c.

◆ READ_PLANE

#define READ_PLANE ( dst,
plane,
b,
c )
Value:
{ \
x = 0; \
for (; CACHED_BITSTREAM_READER && x < width-c && get_bits_left(&gb) > 0;) {\
ret = get_vlc_multi(&gb, (uint8_t *)dst + x * b, multi, \
vlc, vlc_bits, 3, b); \
if (ret <= 0) \
x += ret; \
} \
for (; x < width && get_bits_left(&gb) > 0; x++) \
dst[x] = get_vlc2(&gb, vlc, vlc_bits, 3); \
dst += stride; \
}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
#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 AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define b
Definition input.c:43
#define stride
#define width
Definition dsp.h:89
static double c[64]

Definition at line 123 of file magicyuv.c.

Referenced by magy_decode_slice(), and magy_decode_slice10().

Enumeration Type Documentation

◆ Prediction

enum Prediction
Enumerator
LEFT 
GRADIENT 
MEDIAN 

Definition at line 45 of file magicyuv.c.

Function Documentation

◆ huff_build()

static int huff_build ( AVCodecContext * avctx,
const uint8_t len[],
uint16_t codes_pos[33],
VLC * vlc,
VLC_MULTI * multi,
int nb_elems,
void * logctx )
static

Definition at line 81 of file magicyuv.c.

Referenced by build_huffman().

◆ magicyuv_median_pred16()

static void magicyuv_median_pred16 ( uint16_t * dst,
const uint16_t * src1,
const uint16_t * diff,
intptr_t w,
int * left,
int * left_top,
int max )
static

Definition at line 102 of file magicyuv.c.

Referenced by magy_decode_slice10().

◆ magy_decode_slice10()

static int magy_decode_slice10 ( AVCodecContext * avctx,
void * tdata,
int j,
int threadnr )
static

Definition at line 138 of file magicyuv.c.

Referenced by magy_decode_frame().

◆ magy_decode_slice()

static int magy_decode_slice ( AVCodecContext * avctx,
void * tdata,
int j,
int threadnr )
static

Definition at line 262 of file magicyuv.c.

Referenced by magy_decode_frame().

◆ build_huffman()

static int build_huffman ( AVCodecContext * avctx,
const uint8_t * table,
int table_size,
int max )
static

Definition at line 385 of file magicyuv.c.

Referenced by magy_decode_frame().

◆ magy_decode_frame()

static int magy_decode_frame ( AVCodecContext * avctx,
AVFrame * p,
int * got_frame,
AVPacket * avpkt )
static

Definition at line 438 of file magicyuv.c.

◆ magy_decode_init()

static av_cold int magy_decode_init ( AVCodecContext * avctx)
static

Definition at line 660 of file magicyuv.c.

◆ magy_decode_end()

static av_cold int magy_decode_end ( AVCodecContext * avctx)
static

Definition at line 667 of file magicyuv.c.

Variable Documentation

◆ ff_magicyuv_decoder

const FFCodec ff_magicyuv_decoder
Initial value:
= {
.p.name = "magicyuv",
CODEC_LONG_NAME("MagicYUV video"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(MagicYUVContext),
.p.capabilities = AV_CODEC_CAP_DR1 |
}
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_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_MAGICYUV
Definition codec_id.h:265
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold int magy_decode_init(AVCodecContext *avctx)
Definition magicyuv.c:660
static av_cold int magy_decode_end(AVCodecContext *avctx)
Definition magicyuv.c:667
static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
Definition magicyuv.c:438

Definition at line 682 of file magicyuv.c.