FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
h264_altivec.c File Reference
#include "libavutil/cpu.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/ppc/types_altivec.h"
#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/h264data.h"
#include "libavcodec/h264dsp.h"
#include "dsputil_altivec.h"
#include "h264_altivec_template.c"

Go to the source code of this file.

Macros

#define PUT_OP_U8_ALTIVEC(d, s, dst)   d = s
 
#define AVG_OP_U8_ALTIVEC(d, s, dst)   d = vec_avg(dst, s)
 
#define OP_U8_ALTIVEC   PUT_OP_U8_ALTIVEC
 
#define PREFIX_h264_chroma_mc8_altivec   put_h264_chroma_mc8_altivec
 
#define PREFIX_h264_chroma_mc8_num   altivec_put_h264_chroma_mc8_num
 
#define PREFIX_h264_qpel16_h_lowpass_altivec   put_h264_qpel16_h_lowpass_altivec
 
#define PREFIX_h264_qpel16_h_lowpass_num   altivec_put_h264_qpel16_h_lowpass_num
 
#define PREFIX_h264_qpel16_v_lowpass_altivec   put_h264_qpel16_v_lowpass_altivec
 
#define PREFIX_h264_qpel16_v_lowpass_num   altivec_put_h264_qpel16_v_lowpass_num
 
#define PREFIX_h264_qpel16_hv_lowpass_altivec   put_h264_qpel16_hv_lowpass_altivec
 
#define PREFIX_h264_qpel16_hv_lowpass_num   altivec_put_h264_qpel16_hv_lowpass_num
 
#define OP_U8_ALTIVEC   AVG_OP_U8_ALTIVEC
 
#define PREFIX_h264_chroma_mc8_altivec   avg_h264_chroma_mc8_altivec
 
#define PREFIX_h264_chroma_mc8_num   altivec_avg_h264_chroma_mc8_num
 
#define PREFIX_h264_qpel16_h_lowpass_altivec   avg_h264_qpel16_h_lowpass_altivec
 
#define PREFIX_h264_qpel16_h_lowpass_num   altivec_avg_h264_qpel16_h_lowpass_num
 
#define PREFIX_h264_qpel16_v_lowpass_altivec   avg_h264_qpel16_v_lowpass_altivec
 
#define PREFIX_h264_qpel16_v_lowpass_num   altivec_avg_h264_qpel16_v_lowpass_num
 
#define PREFIX_h264_qpel16_hv_lowpass_altivec   avg_h264_qpel16_hv_lowpass_altivec
 
#define PREFIX_h264_qpel16_hv_lowpass_num   altivec_avg_h264_qpel16_hv_lowpass_num
 
#define H264_MC(OPNAME, SIZE, CODETYPE)
 
#define VEC_1D_DCT(vb0, vb1, vb2, vb3, va0, va1, va2, va3)
 
#define VEC_TRANSPOSE_4(a0, a1, a2, a3, b0, b1, b2, b3)
 
#define VEC_LOAD_U8_ADD_S16_STORE_U8(va)
 
#define IDCT8_1D_ALTIVEC(s0, s1, s2, s3, s4, s5, s6, s7,d0, d1, d2, d3, d4, d5, d6, d7)
 
#define ALTIVEC_STORE_SUM_CLIP(dest, idctv, perm_ldv, perm_stv, sel)
 
#define transpose4x16(r0, r1, r2, r3)
 
#define readAndTranspose16x6(src, src_stride, r8, r9, r10, r11, r12, r13)
 performs a 6x16 transpose of data in src, and stores it to dst
 
#define h264_deblock_p0_q0(p0, p1, q0, q1, tc0masked)
 
#define h264_loop_filter_luma_altivec(p2, p1, p0, q0, q1, q2, alpha, beta, tc0)
 
#define H264_WEIGHT(W)
 
#define dspfunc(PFX, IDX, NUM)
 

Functions

static void put_pixels16_l2_altivec (uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int h)
 
static void avg_pixels16_l2_altivec (uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int h)
 
static void ff_h264_idct_add_altivec (uint8_t *dst, DCTELEM *block, int stride)
 
static void ff_h264_idct8_add_altivec (uint8_t *dst, DCTELEM *dct, int stride)
 
static av_always_inline void h264_idct_dc_add_internal (uint8_t *dst, DCTELEM *block, int stride, int size)
 
static void h264_idct_dc_add_altivec (uint8_t *dst, DCTELEM *block, int stride)
 
static void ff_h264_idct8_dc_add_altivec (uint8_t *dst, DCTELEM *block, int stride)
 
static void ff_h264_idct_add16_altivec (uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15 *8])
 
static void ff_h264_idct_add16intra_altivec (uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15 *8])
 
static void ff_h264_idct8_add4_altivec (uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15 *8])
 
static void ff_h264_idct_add8_altivec (uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[15 *8])
 
static void write16x4 (uint8_t *dst, int dst_stride, register vec_u8 r0, register vec_u8 r1, register vec_u8 r2, register vec_u8 r3)
 
static vec_u8 diff_lt_altivec (register vec_u8 x, register vec_u8 y, register vec_u8 a)
 
static vec_u8 h264_deblock_mask (register vec_u8 p0, register vec_u8 p1, register vec_u8 q0, register vec_u8 q1, register vec_u8 alpha, register vec_u8 beta)
 
static vec_u8 h264_deblock_q1 (register vec_u8 p0, register vec_u8 p1, register vec_u8 p2, register vec_u8 q0, register vec_u8 tc0)
 
static void h264_v_loop_filter_luma_altivec (uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
 
static void h264_h_loop_filter_luma_altivec (uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
 
static av_always_inline void weight_h264_W_altivec (uint8_t *block, int stride, int height, int log2_denom, int weight, int offset, int w)
 
static av_always_inline void biweight_h264_W_altivec (uint8_t *dst, uint8_t *src, int stride, int height, int log2_denom, int weightd, int weights, int offset, int w)
 
void ff_dsputil_h264_init_ppc (DSPContext *c, AVCodecContext *avctx)
 
void ff_h264dsp_init_ppc (H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
 

Macro Definition Documentation

#define PUT_OP_U8_ALTIVEC (   d,
  s,
  dst 
)    d = s

Definition at line 31 of file h264_altivec.c.

#define AVG_OP_U8_ALTIVEC (   d,
  s,
  dst 
)    d = vec_avg(dst, s)

Definition at line 32 of file h264_altivec.c.

#define OP_U8_ALTIVEC   PUT_OP_U8_ALTIVEC

Definition at line 54 of file h264_altivec.c.

#define PREFIX_h264_chroma_mc8_altivec   put_h264_chroma_mc8_altivec

Definition at line 55 of file h264_altivec.c.

#define PREFIX_h264_chroma_mc8_num   altivec_put_h264_chroma_mc8_num

Definition at line 56 of file h264_altivec.c.

#define PREFIX_h264_qpel16_h_lowpass_altivec   put_h264_qpel16_h_lowpass_altivec

Definition at line 57 of file h264_altivec.c.

#define PREFIX_h264_qpel16_h_lowpass_num   altivec_put_h264_qpel16_h_lowpass_num

Definition at line 58 of file h264_altivec.c.

#define PREFIX_h264_qpel16_v_lowpass_altivec   put_h264_qpel16_v_lowpass_altivec

Definition at line 59 of file h264_altivec.c.

#define PREFIX_h264_qpel16_v_lowpass_num   altivec_put_h264_qpel16_v_lowpass_num

Definition at line 60 of file h264_altivec.c.

#define PREFIX_h264_qpel16_hv_lowpass_altivec   put_h264_qpel16_hv_lowpass_altivec

Definition at line 61 of file h264_altivec.c.

#define PREFIX_h264_qpel16_hv_lowpass_num   altivec_put_h264_qpel16_hv_lowpass_num

Definition at line 62 of file h264_altivec.c.

#define OP_U8_ALTIVEC   AVG_OP_U8_ALTIVEC

Definition at line 54 of file h264_altivec.c.

#define PREFIX_h264_chroma_mc8_altivec   avg_h264_chroma_mc8_altivec

Definition at line 55 of file h264_altivec.c.

#define PREFIX_h264_chroma_mc8_num   altivec_avg_h264_chroma_mc8_num

Definition at line 56 of file h264_altivec.c.

#define PREFIX_h264_qpel16_h_lowpass_altivec   avg_h264_qpel16_h_lowpass_altivec

Definition at line 57 of file h264_altivec.c.

#define PREFIX_h264_qpel16_h_lowpass_num   altivec_avg_h264_qpel16_h_lowpass_num

Definition at line 58 of file h264_altivec.c.

#define PREFIX_h264_qpel16_v_lowpass_altivec   avg_h264_qpel16_v_lowpass_altivec

Definition at line 59 of file h264_altivec.c.

#define PREFIX_h264_qpel16_v_lowpass_num   altivec_avg_h264_qpel16_v_lowpass_num

Definition at line 60 of file h264_altivec.c.

#define PREFIX_h264_qpel16_hv_lowpass_altivec   avg_h264_qpel16_hv_lowpass_altivec

Definition at line 61 of file h264_altivec.c.

#define PREFIX_h264_qpel16_hv_lowpass_num   altivec_avg_h264_qpel16_hv_lowpass_num

Definition at line 62 of file h264_altivec.c.

#define H264_MC (   OPNAME,
  SIZE,
  CODETYPE 
)

Definition at line 74 of file h264_altivec.c.

#define VEC_1D_DCT (   vb0,
  vb1,
  vb2,
  vb3,
  va0,
  va1,
  va2,
  va3 
)
Value:
/* 1st stage */ \
vz0 = vec_add(vb0,vb2); /* temp[0] = Y[0] + Y[2] */ \
vz1 = vec_sub(vb0,vb2); /* temp[1] = Y[0] - Y[2] */ \
vz2 = vec_sra(vb1,vec_splat_u16(1)); \
vz2 = vec_sub(vz2,vb3); /* temp[2] = Y[1].1/2 - Y[3] */ \
vz3 = vec_sra(vb3,vec_splat_u16(1)); \
vz3 = vec_add(vb1,vz3); /* temp[3] = Y[1] + Y[3].1/2 */ \
/* 2nd stage: output */ \
va0 = vec_add(vz0,vz3); /* x[0] = temp[0] + temp[3] */ \
va1 = vec_add(vz1,vz2); /* x[1] = temp[1] + temp[2] */ \
va2 = vec_sub(vz1,vz2); /* x[2] = temp[1] - temp[2] */ \
va3 = vec_sub(vz0,vz3) /* x[3] = temp[0] - temp[3] */

Definition at line 281 of file h264_altivec.c.

Referenced by ff_h264_idct_add_altivec().

#define VEC_TRANSPOSE_4 (   a0,
  a1,
  a2,
  a3,
  b0,
  b1,
  b2,
  b3 
)
Value:
b0 = vec_mergeh( a0, a0 ); \
b1 = vec_mergeh( a1, a0 ); \
b2 = vec_mergeh( a2, a0 ); \
b3 = vec_mergeh( a3, a0 ); \
a0 = vec_mergeh( b0, b2 ); \
a1 = vec_mergel( b0, b2 ); \
a2 = vec_mergeh( b1, b3 ); \
a3 = vec_mergel( b1, b3 ); \
b0 = vec_mergeh( a0, a2 ); \
b1 = vec_mergel( a0, a2 ); \
b2 = vec_mergeh( a1, a3 ); \
b3 = vec_mergel( a1, a3 )

Definition at line 295 of file h264_altivec.c.

Referenced by ff_h264_idct_add_altivec().

#define VEC_LOAD_U8_ADD_S16_STORE_U8 (   va)
Value:
vdst_orig = vec_ld(0, dst); \
vdst = vec_perm(vdst_orig, zero_u8v, vdst_mask); \
vdst_ss = (vec_s16) vec_mergeh(zero_u8v, vdst); \
va = vec_add(va, vdst_ss); \
va_u8 = vec_packsu(va, zero_s16v); \
va_u32 = vec_splat((vec_u32)va_u8, 0); \
vec_ste(va_u32, element, (uint32_t*)dst);

Definition at line 309 of file h264_altivec.c.

Referenced by ff_h264_idct_add_altivec().

#define IDCT8_1D_ALTIVEC (   s0,
  s1,
  s2,
  s3,
  s4,
  s5,
  s6,
  s7,
  d0,
  d1,
  d2,
  d3,
  d4,
  d5,
  d6,
  d7 
)

Definition at line 357 of file h264_altivec.c.

Referenced by ff_h264_idct8_add_altivec().

#define ALTIVEC_STORE_SUM_CLIP (   dest,
  idctv,
  perm_ldv,
  perm_stv,
  sel 
)
Value:
{ \
/* unaligned load */ \
vec_u8 hv = vec_ld( 0, dest ); \
vec_u8 lv = vec_ld( 7, dest ); \
vec_u8 dstv = vec_perm( hv, lv, (vec_u8)perm_ldv ); \
vec_s16 idct_sh6 = vec_sra(idctv, sixv); \
vec_u16 dst16 = (vec_u16)vec_mergeh(zero_u8v, dstv); \
vec_s16 idstsum = vec_adds(idct_sh6, (vec_s16)dst16); \
vec_u8 idstsum8 = vec_packsu(zero_s16v, idstsum); \
vec_u8 edgehv; \
/* unaligned store */ \
vec_u8 bodyv = vec_perm( idstsum8, idstsum8, perm_stv );\
vec_u8 edgelv = vec_perm( sel, zero_u8v, perm_stv ); \
lv = vec_sel( lv, bodyv, edgelv ); \
vec_st( lv, 7, dest ); \
hv = vec_ld( 0, dest ); \
edgehv = vec_perm( zero_u8v, sel, perm_stv ); \
hv = vec_sel( hv, bodyv, edgehv ); \
vec_st( hv, 0, dest ); \
}

Definition at line 411 of file h264_altivec.c.

Referenced by ff_h264_idct8_add_altivec().

#define transpose4x16 (   r0,
  r1,
  r2,
  r3 
)
Value:
{ \
register vec_u8 r4; \
register vec_u8 r5; \
register vec_u8 r6; \
register vec_u8 r7; \
\
r4 = vec_mergeh(r0, r2); /*0, 2 set 0*/ \
r5 = vec_mergel(r0, r2); /*0, 2 set 1*/ \
r6 = vec_mergeh(r1, r3); /*1, 3 set 0*/ \
r7 = vec_mergel(r1, r3); /*1, 3 set 1*/ \
\
r0 = vec_mergeh(r4, r6); /*all set 0*/ \
r1 = vec_mergel(r4, r6); /*all set 1*/ \
r2 = vec_mergeh(r5, r7); /*all set 2*/ \
r3 = vec_mergel(r5, r7); /*all set 3*/ \
}

Definition at line 573 of file h264_altivec.c.

Referenced by h264_h_loop_filter_luma_altivec().

#define readAndTranspose16x6 (   src,
  src_stride,
  r8,
  r9,
  r10,
  r11,
  r12,
  r13 
)

performs a 6x16 transpose of data in src, and stores it to dst

Todo:
FIXME: see if we can't spare some vec_lvsl() by them factorizing out of unaligned_load()

Definition at line 623 of file h264_altivec.c.

Referenced by h264_h_loop_filter_luma_altivec().

#define h264_deblock_p0_q0 (   p0,
  p1,
  q0,
  q1,
  tc0masked 
)

Definition at line 740 of file h264_altivec.c.

#define h264_loop_filter_luma_altivec (   p2,
  p1,
  p0,
  q0,
  q1,
  q2,
  alpha,
  beta,
  tc0 
)
#define H264_WEIGHT (   W)
Value:
static void ff_weight_h264_pixels ## W ## _altivec(uint8_t *block, int stride, int height, \
int log2_denom, int weight, int offset){ \
weight_h264_W_altivec(block, stride, height, log2_denom, weight, offset, W); \
}\
static void ff_biweight_h264_pixels ## W ## _altivec(uint8_t *dst, uint8_t *src, int stride, int height, \
int log2_denom, int weightd, int weights, int offset){ \
biweight_h264_W_altivec(dst, src, stride, height, log2_denom, weightd, weights, offset, W); \
}

Definition at line 957 of file h264_altivec.c.

#define dspfunc (   PFX,
  IDX,
  NUM 
)
Value:
c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \
c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_altivec; \
c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_altivec; \
c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_altivec; \
c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_altivec; \
c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_altivec; \
c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_altivec; \
c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_altivec; \
c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_altivec; \
c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_altivec; \
c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_altivec; \
c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_altivec; \
c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_altivec; \
c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_altivec; \
c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_altivec; \
c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_altivec

Function Documentation

static void put_pixels16_l2_altivec ( uint8_t dst,
const uint8_t src1,
const uint8_t src2,
int  dst_stride,
int  src_stride1,
int  h 
)
inlinestatic

Definition at line 184 of file h264_altivec.c.

static void avg_pixels16_l2_altivec ( uint8_t dst,
const uint8_t src1,
const uint8_t src2,
int  dst_stride,
int  src_stride1,
int  h 
)
inlinestatic

Definition at line 226 of file h264_altivec.c.

static void ff_h264_idct_add_altivec ( uint8_t dst,
DCTELEM block,
int  stride 
)
static
static void ff_h264_idct8_add_altivec ( uint8_t dst,
DCTELEM dct,
int  stride 
)
static

Definition at line 432 of file h264_altivec.c.

Referenced by ff_h264_idct8_add4_altivec(), and ff_h264dsp_init_ppc().

static av_always_inline void h264_idct_dc_add_internal ( uint8_t dst,
DCTELEM block,
int  stride,
int  size 
)
static

Definition at line 476 of file h264_altivec.c.

Referenced by ff_h264_idct8_dc_add_altivec(), and h264_idct_dc_add_altivec().

static void h264_idct_dc_add_altivec ( uint8_t dst,
DCTELEM block,
int  stride 
)
static
static void ff_h264_idct8_dc_add_altivec ( uint8_t dst,
DCTELEM block,
int  stride 
)
static

Definition at line 526 of file h264_altivec.c.

Referenced by ff_h264_idct8_add4_altivec(), and ff_h264dsp_init_ppc().

static void ff_h264_idct_add16_altivec ( uint8_t dst,
const int *  block_offset,
DCTELEM block,
int  stride,
const uint8_t  nnzc[15 *8] 
)
static

Definition at line 531 of file h264_altivec.c.

Referenced by ff_h264dsp_init_ppc().

static void ff_h264_idct_add16intra_altivec ( uint8_t dst,
const int *  block_offset,
DCTELEM block,
int  stride,
const uint8_t  nnzc[15 *8] 
)
static

Definition at line 542 of file h264_altivec.c.

Referenced by ff_h264dsp_init_ppc().

static void ff_h264_idct8_add4_altivec ( uint8_t dst,
const int *  block_offset,
DCTELEM block,
int  stride,
const uint8_t  nnzc[15 *8] 
)
static

Definition at line 550 of file h264_altivec.c.

Referenced by ff_h264dsp_init_ppc().

static void ff_h264_idct_add8_altivec ( uint8_t **  dest,
const int *  block_offset,
DCTELEM block,
int  stride,
const uint8_t  nnzc[15 *8] 
)
static

Definition at line 561 of file h264_altivec.c.

Referenced by ff_h264dsp_init_ppc().

static void write16x4 ( uint8_t dst,
int  dst_stride,
register vec_u8  r0,
register vec_u8  r1,
register vec_u8  r2,
register vec_u8  r3 
)
inlinestatic

Definition at line 590 of file h264_altivec.c.

Referenced by h264_h_loop_filter_luma_altivec().

static vec_u8 diff_lt_altivec ( register vec_u8  x,
register vec_u8  y,
register vec_u8  a 
)
inlinestatic

Definition at line 683 of file h264_altivec.c.

Referenced by h264_deblock_mask().

static vec_u8 h264_deblock_mask ( register vec_u8  p0,
register vec_u8  p1,
register vec_u8  q0,
register vec_u8  q1,
register vec_u8  alpha,
register vec_u8  beta 
)
inlinestatic

Definition at line 694 of file h264_altivec.c.

static vec_u8 h264_deblock_q1 ( register vec_u8  p0,
register vec_u8  p1,
register vec_u8  p2,
register vec_u8  q0,
register vec_u8  tc0 
)
inlinestatic

Definition at line 714 of file h264_altivec.c.

static void h264_v_loop_filter_luma_altivec ( uint8_t pix,
int  stride,
int  alpha,
int  beta,
int8_t *  tc0 
)
static

Definition at line 818 of file h264_altivec.c.

Referenced by ff_h264dsp_init_ppc().

static void h264_h_loop_filter_luma_altivec ( uint8_t pix,
int  stride,
int  alpha,
int  beta,
int8_t *  tc0 
)
static

Definition at line 835 of file h264_altivec.c.

Referenced by ff_h264dsp_init_ppc().

static av_always_inline void weight_h264_W_altivec ( uint8_t block,
int  stride,
int  height,
int  log2_denom,
int  weight,
int  offset,
int  w 
)
static

Definition at line 847 of file h264_altivec.c.

static av_always_inline void biweight_h264_W_altivec ( uint8_t dst,
uint8_t src,
int  stride,
int  height,
int  log2_denom,
int  weightd,
int  weights,
int  offset,
int  w 
)
static

Definition at line 893 of file h264_altivec.c.

void ff_dsputil_h264_init_ppc ( DSPContext c,
AVCodecContext avctx 
)

Definition at line 970 of file h264_altivec.c.

Referenced by ff_dsputil_init_ppc().

void ff_h264dsp_init_ppc ( H264DSPContext c,
const int  bit_depth,
const int  chroma_format_idc 
)

Definition at line 1003 of file h264_altivec.c.

Referenced by ff_h264dsp_init().