FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
huffyuvenc.c File Reference

huffyuv encoder More...

#include "avcodec.h"
#include "huffyuv.h"
#include "huffman.h"
#include "huffyuvencdsp.h"
#include "internal.h"
#include "put_bits.h"
#include "libavutil/pixdesc.h"

Go to the source code of this file.

Macros

#define STATS_OUT_SIZE   21*MAX_N*3 + 4
 
#define LOAD4
 
#define LOAD2
 
#define LOAD2_14
 
#define LOAD2_16
 
#define STAT2
 
#define STAT2_16
 
#define WRITE2
 
#define WRITE2_16
 
#define LOAD2
 
#define STAT2
 
#define WRITE2
 
#define LOAD_GBRA
 
#define STAT_BGRA
 
#define WRITE_GBRA
 

Functions

static void diff_bytes (HYuvContext *s, uint8_t *dst, const uint8_t *src0, const uint8_t *src1, int w)
 
static int sub_left_prediction (HYuvContext *s, uint8_t *dst, const uint8_t *src, int w, int left)
 
static void sub_left_prediction_bgr32 (HYuvContext *s, uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha)
 
static void sub_left_prediction_rgb24 (HYuvContext *s, uint8_t *dst, uint8_t *src, int w, int *red, int *green, int *blue)
 
static void sub_median_prediction (HYuvContext *s, uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top)
 
static int store_table (HYuvContext *s, const uint8_t *len, uint8_t *buf)
 
static int store_huffman_tables (HYuvContext *s, uint8_t *buf)
 
static av_cold int encode_init (AVCodecContext *avctx)
 
static int encode_422_bitstream (HYuvContext *s, int offset, int count)
 
static int encode_plane_bitstream (HYuvContext *s, int count, int plane)
 
static int encode_gray_bitstream (HYuvContext *s, int count)
 
static int encode_bgra_bitstream (HYuvContext *s, int count, int planes)
 
static int encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
 
static av_cold int encode_end (AVCodecContext *avctx)
 

Variables

AVCodec ff_huffyuv_encoder
 

Detailed Description

huffyuv encoder

Definition in file huffyuvenc.c.

Macro Definition Documentation

#define STATS_OUT_SIZE   21*MAX_N*3 + 4
#define LOAD4
Value:
int y0 = y[2 * i];\
int y1 = y[2 * i + 1];\
int u0 = u[i];\
int v0 = v[i];

Referenced by encode_422_bitstream().

#define LOAD2
Value:
int y0 = s->temp[0][2 * i];\
int y1 = s->temp[0][2 * i + 1];

Referenced by encode_gray_bitstream(), and encode_plane_bitstream().

#define LOAD2_14
Value:
int y0 = s->temp16[0][2 * i] & mask;\
int y1 = s->temp16[0][2 * i + 1] & mask;

Referenced by encode_plane_bitstream().

#define LOAD2_16
Value:
int y0 = s->temp16[0][2 * i];\
int y1 = s->temp16[0][2 * i + 1];

Referenced by encode_plane_bitstream().

#define STAT2
Value:
s->stats[plane][y0]++;\
s->stats[plane][y1]++;

Referenced by encode_gray_bitstream(), and encode_plane_bitstream().

#define STAT2_16
Value:
s->stats[plane][y0>>2]++;\
s->stats[plane][y1>>2]++;

Referenced by encode_plane_bitstream().

#define WRITE2
Value:
put_bits(&s->pb, s->len[plane][y0], s->bits[plane][y0]);\
put_bits(&s->pb, s->len[plane][y1], s->bits[plane][y1]);

Referenced by encode_gray_bitstream(), and encode_plane_bitstream().

#define WRITE2_16
Value:
put_bits(&s->pb, s->len[plane][y0>>2], s->bits[plane][y0>>2]);\
put_bits(&s->pb, 2, y0&3);\
put_bits(&s->pb, s->len[plane][y1>>2], s->bits[plane][y1>>2]);\
put_bits(&s->pb, 2, y1&3);

Referenced by encode_plane_bitstream().

#define LOAD2
Value:
int y0 = s->temp[0][2 * i];\
int y1 = s->temp[0][2 * i + 1];
#define STAT2
Value:
s->stats[0][y0]++;\
s->stats[0][y1]++;
#define WRITE2
Value:
put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);\
put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
#define LOAD_GBRA
Value:
int g = s->temp[0][planes == 3 ? 3 * i + 1 : 4 * i + G]; \
int b =(s->temp[0][planes == 3 ? 3 * i + 2 : 4 * i + B] - g) & 0xFF;\
int r =(s->temp[0][planes == 3 ? 3 * i + 0 : 4 * i + R] - g) & 0xFF;\
int a = s->temp[0][planes * i + A];

Referenced by encode_bgra_bitstream().

#define STAT_BGRA
Value:
s->stats[0][b]++; \
s->stats[1][g]++; \
s->stats[2][r]++; \
if (planes == 4) \
s->stats[2][a]++;

Referenced by encode_bgra_bitstream().

#define WRITE_GBRA
Value:
put_bits(&s->pb, s->len[1][g], s->bits[1][g]); \
put_bits(&s->pb, s->len[0][b], s->bits[0][b]); \
put_bits(&s->pb, s->len[2][r], s->bits[2][r]); \
if (planes == 4) \
put_bits(&s->pb, s->len[2][a], s->bits[2][a]);

Referenced by encode_bgra_bitstream().

Function Documentation

static void diff_bytes ( HYuvContext s,
uint8_t dst,
const uint8_t src0,
const uint8_t src1,
int  w 
)
inlinestatic

Definition at line 39 of file huffyuvenc.c.

Referenced by encode_frame().

static int sub_left_prediction ( HYuvContext s,
uint8_t dst,
const uint8_t src,
int  w,
int  left 
)
inlinestatic

Definition at line 49 of file huffyuvenc.c.

Referenced by encode_frame().

static void sub_left_prediction_bgr32 ( HYuvContext s,
uint8_t dst,
const uint8_t src,
int  w,
int *  red,
int *  green,
int *  blue,
int *  alpha 
)
inlinestatic

Definition at line 92 of file huffyuvenc.c.

Referenced by encode_frame().

static void sub_left_prediction_rgb24 ( HYuvContext s,
uint8_t dst,
uint8_t src,
int  w,
int *  red,
int *  green,
int *  blue 
)
inlinestatic

Definition at line 127 of file huffyuvenc.c.

Referenced by encode_frame().

static void sub_median_prediction ( HYuvContext s,
uint8_t dst,
const uint8_t src1,
const uint8_t src2,
int  w,
int *  left,
int *  left_top 
)
static

Definition at line 155 of file huffyuvenc.c.

Referenced by encode_frame().

static int store_table ( HYuvContext s,
const uint8_t len,
uint8_t buf 
)
static

Definition at line 164 of file huffyuvenc.c.

Referenced by store_huffman_tables().

static int store_huffman_tables ( HYuvContext s,
uint8_t buf 
)
static

Definition at line 189 of file huffyuvenc.c.

Referenced by encode_frame(), and encode_init().

static av_cold int encode_init ( AVCodecContext avctx)
static

Definition at line 211 of file huffyuvenc.c.

static int encode_422_bitstream ( HYuvContext s,
int  offset,
int  count 
)
static

Definition at line 435 of file huffyuvenc.c.

Referenced by encode_frame().

static int encode_plane_bitstream ( HYuvContext s,
int  count,
int  plane 
)
static

Definition at line 490 of file huffyuvenc.c.

Referenced by encode_frame().

static int encode_gray_bitstream ( HYuvContext s,
int  count 
)
static

Definition at line 599 of file huffyuvenc.c.

Referenced by encode_frame().

static int encode_bgra_bitstream ( HYuvContext s,
int  count,
int  planes 
)
inlinestatic

Definition at line 644 of file huffyuvenc.c.

Referenced by encode_frame().

static int encode_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame pict,
int *  got_packet 
)
static

Definition at line 695 of file huffyuvenc.c.

static av_cold int encode_end ( AVCodecContext avctx)
static

Definition at line 979 of file huffyuvenc.c.

Variable Documentation

AVCodec ff_huffyuv_encoder
Initial value:
= {
.name = "huffyuv",
.long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"),
.priv_data_size = sizeof(HYuvContext),
.encode2 = encode_frame,
.pix_fmts = (const enum AVPixelFormat[]){
},
}

Definition at line 993 of file huffyuvenc.c.