FFmpeg
Data Structures | Macros | Functions | Variables
mimic.c File Reference
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "blockdsp.h"
#include "internal.h"
#include "get_bits.h"
#include "bytestream.h"
#include "bswapdsp.h"
#include "hpeldsp.h"
#include "idctdsp.h"
#include "thread.h"

Go to the source code of this file.

Data Structures

struct  MimicContext
 

Macros

#define MIMIC_HEADER_SIZE   20
 
#define MIMIC_VLC_BITS   11
 

Functions

static av_cold int mimic_decode_end (AVCodecContext *avctx)
 
static av_cold void mimic_init_static (void)
 
static av_cold int mimic_decode_init (AVCodecContext *avctx)
 
static int vlc_decode_block (MimicContext *ctx, int num_coeffs, int qscale)
 
static int decode (MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
 
static void flip_swap_frame (AVFrame *f)
 Flip the buffer upside-down and put it in the YVU order to revert the way Mimic encodes frames. More...
 
static int mimic_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 

Variables

static VLC block_vlc
 
static const uint8_t huffsyms []
 
static const uint8_t huffbits []
 
static const uint8_t col_zag [64]
 
static const int8_t vlcdec_lookup [9][64]
 
const AVCodec ff_mimic_decoder
 

Macro Definition Documentation

◆ MIMIC_HEADER_SIZE

#define MIMIC_HEADER_SIZE   20

Definition at line 39 of file mimic.c.

◆ MIMIC_VLC_BITS

#define MIMIC_VLC_BITS   11

Definition at line 40 of file mimic.c.

Function Documentation

◆ mimic_decode_end()

static av_cold int mimic_decode_end ( AVCodecContext avctx)
static

Definition at line 104 of file mimic.c.

◆ mimic_init_static()

static av_cold void mimic_init_static ( void  )
static

Definition at line 121 of file mimic.c.

Referenced by mimic_decode_init().

◆ mimic_decode_init()

static av_cold int mimic_decode_init ( AVCodecContext avctx)
static

Definition at line 127 of file mimic.c.

◆ vlc_decode_block()

static int vlc_decode_block ( MimicContext ctx,
int  num_coeffs,
int  qscale 
)
static

Definition at line 215 of file mimic.c.

Referenced by decode().

◆ decode()

static int decode ( MimicContext ctx,
int  quality,
int  num_coeffs,
int  is_iframe 
)
static

Definition at line 259 of file mimic.c.

Referenced by mimic_decode_frame().

◆ flip_swap_frame()

static void flip_swap_frame ( AVFrame f)
static

Flip the buffer upside-down and put it in the YVU order to revert the way Mimic encodes frames.

Definition at line 329 of file mimic.c.

Referenced by mimic_decode_frame().

◆ mimic_decode_frame()

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

Definition at line 340 of file mimic.c.

Variable Documentation

◆ block_vlc

VLC block_vlc
static

Definition at line 70 of file mimic.c.

Referenced by mimic_init_static(), and vlc_decode_block().

◆ huffsyms

const uint8_t huffsyms[]
static
Initial value:
= {
0x10, 0x20, 0x30, 0x00, 0x11, 0x40, 0x50, 0x12, 0x13, 0x21, 0x31, 0x60,
0x14, 0x15, 0x16, 0x22, 0x41, 0x17, 0x18, 0x23, 0x24, 0x25, 0x32, 0x42,
0x51, 0x61, 0x70, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x26, 0x27,
0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x52, 0x53, 0x54, 0x55, 0x56,
0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x62, 0x63, 0x64, 0x65,
0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x71, 0x72, 0x73,
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E,
}

Definition at line 72 of file mimic.c.

Referenced by mimic_init_static().

◆ huffbits

const uint8_t huffbits[]
static
Initial value:
= {
2, 2, 3, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8,
8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12,
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17,
17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21,
22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26,
26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30,
}

Definition at line 84 of file mimic.c.

Referenced by mimic_init_static().

◆ col_zag

const uint8_t col_zag[64]
static
Initial value:
= {
0, 8, 1, 2, 9, 16, 24, 17,
10, 3, 4, 11, 18, 25, 32, 40,
33, 26, 19, 12, 5, 6, 13, 20,
27, 34, 41, 48, 56, 49, 42, 35,
28, 21, 14, 7, 15, 22, 29, 36,
43, 50, 57, 58, 51, 44, 37, 30,
23, 31, 38, 45, 52, 59, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63,
}

Definition at line 93 of file mimic.c.

Referenced by mimic_decode_init().

◆ vlcdec_lookup

const int8_t vlcdec_lookup[9][64]
static

Definition at line 178 of file mimic.c.

Referenced by vlc_decode_block().

◆ ff_mimic_decoder

const AVCodec ff_mimic_decoder
Initial value:
= {
.name = "mimic",
.long_name = NULL_IF_CONFIG_SMALL("Mimic"),
.priv_data_size = sizeof(MimicContext),
.close = mimic_decode_end,
.update_thread_context = ONLY_IF_THREADS_ENABLED(mimic_decode_update_thread_context),
.caps_internal = FF_CODEC_CAP_ALLOCATE_PROGRESS |
}

Definition at line 438 of file mimic.c.

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
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
mimic_decode_frame
static int mimic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: mimic.c:340
AV_CODEC_ID_MIMIC
@ AV_CODEC_ID_MIMIC
Definition: codec_id.h:163
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:113
ONLY_IF_THREADS_ENABLED
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
Definition: internal.h:156
mimic_decode_end
static av_cold int mimic_decode_end(AVCodecContext *avctx)
Definition: mimic.c:104
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
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
mimic_decode_init
static av_cold int mimic_decode_init(AVCodecContext *avctx)
Definition: mimic.c:127
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:50
decode
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
Definition: mimic.c:259
update_thread_context
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have update_thread_context() run it in the next thread. Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little speed gain at this point but it should work. If there are inter-frame dependencies
MimicContext
Definition: mimic.c:42
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FF_CODEC_CAP_ALLOCATE_PROGRESS
#define FF_CODEC_CAP_ALLOCATE_PROGRESS
Definition: internal.h:77