FFmpeg
Data Structures | Macros | Functions | Variables
smcenc.c File Reference
#include "libavutil/common.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include "bytestream.h"

Go to the source code of this file.

Data Structures

struct  SMCContext
 

Macros

#define CPAIR   2
 
#define CQUAD   4
 
#define COCTET   8
 
#define COLORS_PER_TABLE   256
 
#define ADVANCE_BLOCK(pixel_ptr, row_ptr, nb_blocks)
 
#define CACHE_PAIR(x)
 
#define CACHE_QUAD(x)
 
#define CACHE_OCTET(x)
 

Functions

static int smc_cmp_values (const void *a, const void *b)
 
static int count_distinct_items (const uint8_t *block_values, uint8_t *distinct_values, int size)
 
static void smc_encode_stream (SMCContext *s, const AVFrame *frame, PutByteContext *pb)
 
static int smc_encode_init (AVCodecContext *avctx)
 
static int smc_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
static int smc_encode_end (AVCodecContext *avctx)
 

Variables

const FFCodec ff_smc_encoder
 

Detailed Description

QT SMC Video Encoder by Paul B. Mahol

Definition in file smcenc.c.

Macro Definition Documentation

◆ CPAIR

#define CPAIR   2

Definition at line 34 of file smcenc.c.

◆ CQUAD

#define CQUAD   4

Definition at line 35 of file smcenc.c.

◆ COCTET

#define COCTET   8

Definition at line 36 of file smcenc.c.

◆ COLORS_PER_TABLE

#define COLORS_PER_TABLE   256

Definition at line 38 of file smcenc.c.

◆ ADVANCE_BLOCK

#define ADVANCE_BLOCK (   pixel_ptr,
  row_ptr,
  nb_blocks 
)
Value:
{ \
for (int block = 0; block < nb_blocks && pixel_ptr && row_ptr; block++) { \
pixel_ptr += 4; \
cur_x += 4; \
if (pixel_ptr - row_ptr >= width) \
{ \
row_ptr += stride * 4; \
pixel_ptr = row_ptr; \
cur_y += 4; \
cur_x = 0; \
} \
} \
}

Definition at line 56 of file smcenc.c.

◆ CACHE_PAIR

#define CACHE_PAIR (   x)
Value:
(s->color_pairs[i][0] == distinct_values[x] || \
s->color_pairs[i][1] == distinct_values[x])

Definition at line 95 of file smcenc.c.

◆ CACHE_QUAD

#define CACHE_QUAD (   x)
Value:
(s->color_quads[i][0] == distinct_values[x] || \
s->color_quads[i][1] == distinct_values[x] || \
s->color_quads[i][2] == distinct_values[x] || \
s->color_quads[i][3] == distinct_values[x])

Definition at line 99 of file smcenc.c.

◆ CACHE_OCTET

#define CACHE_OCTET (   x)
Value:
(s->color_octets[i][0] == distinct_values[x] || \
s->color_octets[i][1] == distinct_values[x] || \
s->color_octets[i][2] == distinct_values[x] || \
s->color_octets[i][3] == distinct_values[x] || \
s->color_octets[i][4] == distinct_values[x] || \
s->color_octets[i][5] == distinct_values[x] || \
s->color_octets[i][6] == distinct_values[x] || \
s->color_octets[i][7] == distinct_values[x])

Definition at line 105 of file smcenc.c.

Function Documentation

◆ smc_cmp_values()

static int smc_cmp_values ( const void *  a,
const void *  b 
)
static

Definition at line 71 of file smcenc.c.

Referenced by smc_encode_stream().

◆ count_distinct_items()

static int count_distinct_items ( const uint8_t *  block_values,
uint8_t *  distinct_values,
int  size 
)
static

Definition at line 78 of file smcenc.c.

Referenced by smc_encode_stream().

◆ smc_encode_stream()

static void smc_encode_stream ( SMCContext s,
const AVFrame frame,
PutByteContext pb 
)
static

Definition at line 115 of file smcenc.c.

Referenced by smc_encode_frame().

◆ smc_encode_init()

static int smc_encode_init ( AVCodecContext avctx)
static

Definition at line 518 of file smcenc.c.

◆ smc_encode_frame()

static int smc_encode_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame frame,
int *  got_packet 
)
static

Definition at line 531 of file smcenc.c.

◆ smc_encode_end()

static int smc_encode_end ( AVCodecContext avctx)
static

Definition at line 583 of file smcenc.c.

Variable Documentation

◆ ff_smc_encoder

const FFCodec ff_smc_encoder
Initial value:
= {
.p.name = "smc",
CODEC_LONG_NAME("QuickTime Graphics (SMC)"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_SMC,
.priv_data_size = sizeof(SMCContext),
.close = smc_encode_end,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_PAL8,
}

Definition at line 592 of file smcenc.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
smc_encode_frame
static int smc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: smcenc.c:531
smc_encode_init
static int smc_encode_init(AVCodecContext *avctx)
Definition: smcenc.c:518
AV_CODEC_ID_SMC
@ AV_CODEC_ID_SMC
Definition: codec_id.h:101
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:320
SMCContext
Definition: smcenc.c:40
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
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
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
stride
#define stride
Definition: h264pred_template.c:537
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:84
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
width
#define width
Definition: dsp.h:85
smc_encode_end
static int smc_encode_end(AVCodecContext *avctx)
Definition: smcenc.c:583