FFmpeg
Macros | Functions | Variables
cavs.c File Reference
#include "libavutil/mem.h"
#include "avcodec.h"
#include "golomb.h"
#include "h264chroma.h"
#include "idctdsp.h"
#include "mathops.h"
#include "qpeldsp.h"
#include "cavs.h"

Go to the source code of this file.

Macros

#define SET_PARAMS
 
#define LOWPASS(ARRAY, INDEX)   ((ARRAY[(INDEX) - 1] + 2 * ARRAY[(INDEX)] + ARRAY[(INDEX) + 1] + 2) >> 2)
 

Functions

static int get_bs (cavs_vector *mvP, cavs_vector *mvQ, int b)
 
void ff_cavs_filter (AVSContext *h, enum cavs_mb mb_type)
 in-loop deblocking filter for a single macroblock More...
 
void ff_cavs_load_intra_pred_luma (AVSContext *h, uint8_t *top, uint8_t **left, int block)
 
void ff_cavs_load_intra_pred_chroma (AVSContext *h)
 
static void intra_pred_vert (uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
 
static void intra_pred_horiz (uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
 
static void intra_pred_dc_128 (uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
 
static void intra_pred_plane (uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
 
static void intra_pred_lp (uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
 
static void intra_pred_down_left (uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
 
static void intra_pred_down_right (uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
 
static void intra_pred_lp_left (uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
 
static void intra_pred_lp_top (uint8_t *d, uint8_t *top, uint8_t *left, ptrdiff_t stride)
 
static void modify_pred (const int8_t *mod_table, int *mode)
 
void ff_cavs_modify_mb_i (AVSContext *h, int *pred_mode_uv)
 
static void mc_dir_part (AVSContext *h, AVFrame *pic, int chroma_height, int delta, int list, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int src_x_offset, int src_y_offset, qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op, cavs_vector *mv)
 
static void mc_part_std (AVSContext *h, int chroma_height, int delta, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int x_offset, int y_offset, qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg, cavs_vector *mv)
 
void ff_cavs_inter (AVSContext *h, enum cavs_mb mb_type)
 
static void scale_mv (AVSContext *h, int *d_x, int *d_y, cavs_vector *src, int distp)
 
static void mv_pred_median (AVSContext *h, cavs_vector *mvP, cavs_vector *mvA, cavs_vector *mvB, cavs_vector *mvC)
 
void ff_cavs_mv (AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC, enum cavs_mv_pred mode, enum cavs_block size, int ref)
 
void ff_cavs_init_mb (AVSContext *h)
 initialise predictors for motion vectors and intra prediction More...
 
int ff_cavs_next_mb (AVSContext *h)
 save predictors for later macroblocks and increase macroblock address More...
 
int ff_cavs_init_pic (AVSContext *h)
 
int ff_cavs_init_top_lines (AVSContext *h)
 some predictions require data from the top-neighbouring macroblock. More...
 
av_cold int ff_cavs_init (AVCodecContext *avctx)
 
av_cold int ff_cavs_end (AVCodecContext *avctx)
 

Variables

static const uint8_t alpha_tab [64]
 
static const uint8_t beta_tab [64]
 
static const uint8_t tc_tab [64]
 
static const cavs_vector un_mv = { 0, 0, 1, NOT_AVAIL }
 mark block as unavailable, i.e. More...
 
static const int8_t left_modifier_l [8] = { 0, -1, 6, -1, -1, 7, 6, 7 }
 
static const int8_t top_modifier_l [8] = { -1, 1, 5, -1, -1, 5, 7, 7 }
 
static const int8_t left_modifier_c [7] = { 5, -1, 2, -1, 6, 5, 6 }
 
static const int8_t top_modifier_c [7] = { 4, 1, -1, -1, 4, 6, 6 }
 

Detailed Description

Chinese AVS video (AVS1-P2, JiZhun profile) decoder

Author
Stefan Gehrer stefa.nosp@m.n.ge.nosp@m.hrer@.nosp@m.gmx..nosp@m.de

Definition in file cavs.c.

Macro Definition Documentation

◆ SET_PARAMS

#define SET_PARAMS
Value:
alpha = alpha_tab[av_clip_uintp2(qp_avg + h->alpha_offset, 6)]; \
beta = beta_tab[av_clip_uintp2(qp_avg + h->beta_offset, 6)]; \
tc = tc_tab[av_clip_uintp2(qp_avg + h->alpha_offset, 6)];

Definition at line 92 of file cavs.c.

◆ LOWPASS

#define LOWPASS (   ARRAY,
  INDEX 
)    ((ARRAY[(INDEX) - 1] + 2 * ARRAY[(INDEX)] + ARRAY[(INDEX) + 1] + 2) >> 2)

Definition at line 303 of file cavs.c.

Function Documentation

◆ get_bs()

static int get_bs ( cavs_vector mvP,
cavs_vector mvQ,
int  b 
)
inlinestatic

Definition at line 73 of file cavs.c.

Referenced by ff_cavs_filter().

◆ ff_cavs_filter()

void ff_cavs_filter ( AVSContext h,
enum cavs_mb  mb_type 
)

in-loop deblocking filter for a single macroblock

boundary strength (bs) mapping:

–4—5– 0 2 | | 6 | 7 |

1 3 |

Definition at line 108 of file cavs.c.

Referenced by decode_mb_b(), decode_mb_i(), and decode_mb_p().

◆ ff_cavs_load_intra_pred_luma()

void ff_cavs_load_intra_pred_luma ( AVSContext h,
uint8_t *  top,
uint8_t **  left,
int  block 
)

Definition at line 184 of file cavs.c.

Referenced by decode_mb_i().

◆ ff_cavs_load_intra_pred_chroma()

void ff_cavs_load_intra_pred_chroma ( AVSContext h)

Definition at line 235 of file cavs.c.

Referenced by decode_mb_i().

◆ intra_pred_vert()

static void intra_pred_vert ( uint8_t *  d,
uint8_t *  top,
uint8_t *  left,
ptrdiff_t  stride 
)
static

Definition at line 258 of file cavs.c.

Referenced by ff_cavs_init().

◆ intra_pred_horiz()

static void intra_pred_horiz ( uint8_t *  d,
uint8_t *  top,
uint8_t *  left,
ptrdiff_t  stride 
)
static

Definition at line 266 of file cavs.c.

Referenced by ff_cavs_init().

◆ intra_pred_dc_128()

static void intra_pred_dc_128 ( uint8_t *  d,
uint8_t *  top,
uint8_t *  left,
ptrdiff_t  stride 
)
static

Definition at line 276 of file cavs.c.

Referenced by ff_cavs_init().

◆ intra_pred_plane()

static void intra_pred_plane ( uint8_t *  d,
uint8_t *  top,
uint8_t *  left,
ptrdiff_t  stride 
)
static

Definition at line 284 of file cavs.c.

Referenced by ff_cavs_init().

◆ intra_pred_lp()

static void intra_pred_lp ( uint8_t *  d,
uint8_t *  top,
uint8_t *  left,
ptrdiff_t  stride 
)
static

Definition at line 306 of file cavs.c.

Referenced by ff_cavs_init().

◆ intra_pred_down_left()

static void intra_pred_down_left ( uint8_t *  d,
uint8_t *  top,
uint8_t *  left,
ptrdiff_t  stride 
)
static

Definition at line 314 of file cavs.c.

Referenced by ff_cavs_init().

◆ intra_pred_down_right()

static void intra_pred_down_right ( uint8_t *  d,
uint8_t *  top,
uint8_t *  left,
ptrdiff_t  stride 
)
static

Definition at line 322 of file cavs.c.

Referenced by ff_cavs_init().

◆ intra_pred_lp_left()

static void intra_pred_lp_left ( uint8_t *  d,
uint8_t *  top,
uint8_t *  left,
ptrdiff_t  stride 
)
static

Definition at line 335 of file cavs.c.

Referenced by ff_cavs_init().

◆ intra_pred_lp_top()

static void intra_pred_lp_top ( uint8_t *  d,
uint8_t *  top,
uint8_t *  left,
ptrdiff_t  stride 
)
static

Definition at line 343 of file cavs.c.

Referenced by ff_cavs_init().

◆ modify_pred()

static void modify_pred ( const int8_t *  mod_table,
int *  mode 
)
inlinestatic

Definition at line 353 of file cavs.c.

Referenced by ff_cavs_modify_mb_i().

◆ ff_cavs_modify_mb_i()

void ff_cavs_modify_mb_i ( AVSContext h,
int *  pred_mode_uv 
)

Definition at line 362 of file cavs.c.

Referenced by decode_mb_i().

◆ mc_dir_part()

static void mc_dir_part ( AVSContext h,
AVFrame pic,
int  chroma_height,
int  delta,
int  list,
uint8_t *  dest_y,
uint8_t *  dest_cb,
uint8_t *  dest_cr,
int  src_x_offset,
int  src_y_offset,
qpel_mc_func qpix_op,
h264_chroma_mc_func  chroma_op,
cavs_vector mv 
)
inlinestatic

Definition at line 389 of file cavs.c.

Referenced by mc_part_std().

◆ mc_part_std()

static void mc_part_std ( AVSContext h,
int  chroma_height,
int  delta,
uint8_t *  dest_y,
uint8_t *  dest_cb,
uint8_t *  dest_cr,
int  x_offset,
int  y_offset,
qpel_mc_func qpix_put,
h264_chroma_mc_func  chroma_put,
qpel_mc_func qpix_avg,
h264_chroma_mc_func  chroma_avg,
cavs_vector mv 
)
inlinestatic

Definition at line 455 of file cavs.c.

Referenced by ff_cavs_inter(), and mc_part().

◆ ff_cavs_inter()

void ff_cavs_inter ( AVSContext h,
enum cavs_mb  mb_type 
)

Definition at line 493 of file cavs.c.

Referenced by decode_mb_b(), and decode_mb_p().

◆ scale_mv()

static void scale_mv ( AVSContext h,
int *  d_x,
int *  d_y,
cavs_vector src,
int  distp 
)
inlinestatic

Definition at line 536 of file cavs.c.

Referenced by mv_pred_median().

◆ mv_pred_median()

static void mv_pred_median ( AVSContext h,
cavs_vector mvP,
cavs_vector mvA,
cavs_vector mvB,
cavs_vector mvC 
)
inlinestatic

Definition at line 544 of file cavs.c.

Referenced by ff_cavs_mv().

◆ ff_cavs_mv()

void ff_cavs_mv ( AVSContext h,
enum cavs_mv_loc  nP,
enum cavs_mv_loc  nC,
enum cavs_mv_pred  mode,
enum cavs_block  size,
int  ref 
)

Definition at line 574 of file cavs.c.

Referenced by decode_mb_b(), and decode_mb_p().

◆ ff_cavs_init_mb()

void ff_cavs_init_mb ( AVSContext h)

initialise predictors for motion vectors and intra prediction

Definition at line 636 of file cavs.c.

Referenced by decode_mb_b(), decode_mb_i(), and decode_mb_p().

◆ ff_cavs_next_mb()

int ff_cavs_next_mb ( AVSContext h)

save predictors for later macroblocks and increase macroblock address

Returns
0 if end of frame is reached, 1 otherwise

Definition at line 677 of file cavs.c.

Referenced by decode_pic().

◆ ff_cavs_init_pic()

int ff_cavs_init_pic ( AVSContext h)

Definition at line 722 of file cavs.c.

Referenced by decode_pic().

◆ ff_cavs_init_top_lines()

int ff_cavs_init_top_lines ( AVSContext h)

some predictions require data from the top-neighbouring macroblock.

this data has to be stored for one complete row of macroblocks and this storage space is allocated here

Definition at line 758 of file cavs.c.

Referenced by decode_seq_header().

◆ ff_cavs_init()

av_cold int ff_cavs_init ( AVCodecContext avctx)

Definition at line 793 of file cavs.c.

◆ ff_cavs_end()

av_cold int ff_cavs_end ( AVCodecContext avctx)

Definition at line 836 of file cavs.c.

Variable Documentation

◆ alpha_tab

const uint8_t alpha_tab[64]
static
Initial value:
= {
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3,
4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 18, 20,
22, 24, 26, 28, 30, 33, 33, 35, 35, 36, 37, 37, 39, 39, 42, 44,
46, 48, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
}

Definition at line 37 of file cavs.c.

Referenced by ps_tableinit().

◆ beta_tab

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

Definition at line 44 of file cavs.c.

◆ tc_tab

const uint8_t tc_tab[64]
static
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9
}

Definition at line 51 of file cavs.c.

◆ un_mv

const cavs_vector un_mv = { 0, 0, 1, NOT_AVAIL }
static

mark block as unavailable, i.e.

out of picture or not yet decoded

Definition at line 60 of file cavs.c.

Referenced by ff_cavs_init(), ff_cavs_init_mb(), ff_cavs_init_pic(), ff_cavs_mv(), and ff_cavs_next_mb().

◆ left_modifier_l

const int8_t left_modifier_l[8] = { 0, -1, 6, -1, -1, 7, 6, 7 }
static

Definition at line 62 of file cavs.c.

Referenced by ff_cavs_modify_mb_i().

◆ top_modifier_l

const int8_t top_modifier_l[8] = { -1, 1, 5, -1, -1, 5, 7, 7 }
static

Definition at line 63 of file cavs.c.

Referenced by ff_cavs_modify_mb_i().

◆ left_modifier_c

const int8_t left_modifier_c[7] = { 5, -1, 2, -1, 6, 5, 6 }
static

Definition at line 64 of file cavs.c.

Referenced by ff_cavs_modify_mb_i().

◆ top_modifier_c

const int8_t top_modifier_c[7] = { 4, 1, -1, -1, 4, 6, 6 }
static

Definition at line 65 of file cavs.c.

Referenced by ff_cavs_modify_mb_i().

av_clip_uintp2
#define av_clip_uintp2
Definition: common.h:124
tc_tab
static const uint8_t tc_tab[64]
Definition: cavs.c:51
beta_tab
static const uint8_t beta_tab[64]
Definition: cavs.c:44
alpha
static const int16_t alpha[]
Definition: ilbcdata.h:55
alpha_tab
static const uint8_t alpha_tab[64]
Definition: cavs.c:37
h
h
Definition: vp9dsp_template.c:2070