FFmpeg
Data Structures | Macros | Functions | Variables
smcenc.c File Reference
#include "libavutil/common.h"
#include "avcodec.h"
#include "encode.h"
#include "internal.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 AVCodec 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; \
if (pixel_ptr - row_ptr >= width) \
{ \
row_ptr += stride * 4; \
pixel_ptr = row_ptr; \
} \
} \
}

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 92 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 96 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 102 of file smcenc.c.

Function Documentation

◆ smc_cmp_values()

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

Definition at line 68 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 75 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 112 of file smcenc.c.

Referenced by smc_encode_frame().

◆ smc_encode_init()

static int smc_encode_init ( AVCodecContext avctx)
static

Definition at line 476 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 489 of file smcenc.c.

◆ smc_encode_end()

static int smc_encode_end ( AVCodecContext avctx)
static

Definition at line 542 of file smcenc.c.

Variable Documentation

◆ ff_smc_encoder

const AVCodec ff_smc_encoder
Initial value:
= {
.name = "smc",
.long_name = NULL_IF_CONFIG_SMALL("QuickTime Graphics (SMC)"),
.priv_data_size = sizeof(SMCContext),
.encode2 = smc_encode_frame,
.close = smc_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_PAL8,
}

Definition at line 551 of file smcenc.c.

stride
int stride
Definition: mace.c:144
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
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
smc_encode_frame
static int smc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: smcenc.c:489
smc_encode_init
static int smc_encode_init(AVCodecContext *avctx)
Definition: smcenc.c:476
init
static int init
Definition: av_tx.c:47
AV_CODEC_ID_SMC
@ AV_CODEC_ID_SMC
Definition: codec_id.h:99
SMCContext
Definition: smcenc.c:40
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:257
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:296
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
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
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
smc_encode_end
static int smc_encode_end(AVCodecContext *avctx)
Definition: smcenc.c:542