FFmpeg
Macros | Functions | Variables
mss34dsp.c File Reference
#include <stdint.h>
#include "libavutil/common.h"
#include "mss34dsp.h"

Go to the source code of this file.

Macros

#define DCT_TEMPLATE(blk, step, SOP, shift)
 
#define SOP_ROW(a)   (((a) * (1U << 16)) + 0x2000)
 
#define SOP_COL(a)   (((a) + 32) * (1U << 16))
 

Functions

void ff_mss34_gen_quant_mat (uint16_t *qmat, int quality, int luma)
 Generate quantisation matrix for given quality. More...
 
void ff_mss34_dct_put (uint8_t *dst, ptrdiff_t stride, int *block)
 Transform and output DCT block. More...
 

Variables

static const uint8_t luma_quant [64]
 
static const uint8_t chroma_quant [64]
 

Macro Definition Documentation

◆ DCT_TEMPLATE

#define DCT_TEMPLATE (   blk,
  step,
  SOP,
  shift 
)
Value:
const unsigned t0 =-39409U * blk[7 * step] - 58980U * blk[1 * step]; \
const unsigned t1 = 39410U * blk[1 * step] - 58980U * blk[7 * step]; \
const unsigned t2 =-33410U * blk[5 * step] -167963U * blk[3 * step]; \
const unsigned t3 = 33410U * blk[3 * step] -167963U * blk[5 * step]; \
const unsigned t4 = blk[3 * step] + blk[7 * step]; \
const unsigned t5 = blk[1 * step] + blk[5 * step]; \
const unsigned t6 = 77062U * t4 + 51491U * t5; \
const unsigned t7 = 77062U * t5 - 51491U * t4; \
const unsigned t8 = 35470U * blk[2 * step] - 85623U * blk[6 * step]; \
const unsigned t9 = 35470U * blk[6 * step] + 85623U * blk[2 * step]; \
const unsigned tA = SOP(blk[0 * step] - blk[4 * step]); \
const unsigned tB = SOP(blk[0 * step] + blk[4 * step]); \
\
blk[0 * step] = (int)( t1 + t6 + t9 + tB) >> shift; \
blk[1 * step] = (int)( t3 + t7 + t8 + tA) >> shift; \
blk[2 * step] = (int)( t2 + t6 - t8 + tA) >> shift; \
blk[3 * step] = (int)( t0 + t7 - t9 + tB) >> shift; \
blk[4 * step] = (int)(-(t0 + t7) - t9 + tB) >> shift; \
blk[5 * step] = (int)(-(t2 + t6) - t8 + tA) >> shift; \
blk[6 * step] = (int)(-(t3 + t7) + t8 + tA) >> shift; \
blk[7 * step] = (int)(-(t1 + t6) + t9 + tB) >> shift; \

Definition at line 64 of file mss34dsp.c.

◆ SOP_ROW

#define SOP_ROW (   a)    (((a) * (1U << 16)) + 0x2000)

Definition at line 87 of file mss34dsp.c.

◆ SOP_COL

#define SOP_COL (   a)    (((a) + 32) * (1U << 16))

Definition at line 88 of file mss34dsp.c.

Function Documentation

◆ ff_mss34_gen_quant_mat()

void ff_mss34_gen_quant_mat ( uint16_t *  qmat,
int  quality,
int  luma 
)

Generate quantisation matrix for given quality.

Parameters
qmatdestination matrix
qualityquality setting (1-100)
lumagenerate quantisation matrix for luma or chroma

Definition at line 48 of file mss34dsp.c.

Referenced by mss4_decode_frame(), and reset_coders().

◆ ff_mss34_dct_put()

void ff_mss34_dct_put ( uint8_t dst,
ptrdiff_t  stride,
int block 
)

Transform and output DCT block.

Parameters
dstoutput plane
strideoutput plane stride
blockblock to transform and output

Definition at line 90 of file mss34dsp.c.

Referenced by decode_dct_block(), and mss4_decode_dct_block().

Variable Documentation

◆ luma_quant

const uint8_t luma_quant[64]
static
Initial value:
= {
16, 11, 10, 16, 24, 40, 51, 61,
12, 12, 14, 19, 26, 58, 60, 55,
14, 13, 16, 24, 40, 57, 69, 56,
14, 17, 22, 29, 51, 87, 80, 62,
18, 22, 37, 56, 68, 109, 103, 77,
24, 35, 55, 64, 81, 104, 113, 92,
49, 64, 78, 87, 103, 121, 120, 101,
72, 92, 95, 98, 112, 100, 103, 99
}

Definition at line 26 of file mss34dsp.c.

Referenced by ff_mss34_gen_quant_mat().

◆ chroma_quant

const uint8_t chroma_quant[64]
static
Initial value:
= {
17, 18, 24, 47, 99, 99, 99, 99,
18, 21, 26, 66, 99, 99, 99, 99,
24, 26, 56, 99, 99, 99, 99, 99,
47, 66, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99
}

Definition at line 37 of file mss34dsp.c.

Referenced by ff_mss34_gen_quant_mat().

step
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
Definition: rate_distortion.txt:58
t0
#define t0
Definition: regdef.h:28
t1
#define t1
Definition: regdef.h:29
U
#define U(x)
Definition: vp56_arith.h:37
t7
#define t7
Definition: regdef.h:35
blk
#define blk(i)
Definition: sha.c:185
t5
#define t5
Definition: regdef.h:33
t6
#define t6
Definition: regdef.h:34
t8
#define t8
Definition: regdef.h:53
t4
#define t4
Definition: regdef.h:32
t3
#define t3
Definition: regdef.h:31
t2
#define t2
Definition: regdef.h:30
shift
static int shift(int a, int b)
Definition: sonic.c:82
t9
#define t9
Definition: regdef.h:54
int
int
Definition: ffmpeg_filter.c:192