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

Go to the source code of this file.

Macros

#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)
 

Functions

static void ff_h264_idct_add_altivec (uint8_t *dst, int16_t *block, int stride)
 
static void ff_h264_idct8_add_altivec (uint8_t *dst, int16_t *dct, int stride)
 
static av_always_inline void h264_idct_dc_add_internal (uint8_t *dst, int16_t *block, int stride, int size)
 
static void h264_idct_dc_add_altivec (uint8_t *dst, int16_t *block, int stride)
 
static void ff_h264_idct8_dc_add_altivec (uint8_t *dst, int16_t *block, int stride)
 
static void ff_h264_idct_add16_altivec (uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15 *8])
 
static void ff_h264_idct_add16intra_altivec (uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15 *8])
 
static void ff_h264_idct8_add4_altivec (uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15 *8])
 
static void ff_h264_idct_add8_altivec (uint8_t **dest, const int *block_offset, int16_t *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)
 
av_cold void ff_h264dsp_init_ppc (H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
 

Macro Definition Documentation

#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 33 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 47 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 61 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 110 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 164 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 328 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 378 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 495 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 712 of file h264_altivec.c.

Function Documentation

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

Definition at line 185 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,
int16_t *  block,
int  stride,
int  size 
)
static

Definition at line 230 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,
int16_t *  block,
int  stride 
)
static
static void ff_h264_idct8_dc_add_altivec ( uint8_t dst,
int16_t *  block,
int  stride 
)
static

Definition at line 281 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,
int16_t *  block,
int  stride,
const uint8_t  nnzc[15 *8] 
)
static

Definition at line 286 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,
int16_t *  block,
int  stride,
const uint8_t  nnzc[15 *8] 
)
static

Definition at line 297 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,
int16_t *  block,
int  stride,
const uint8_t  nnzc[15 *8] 
)
static

Definition at line 305 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,
int16_t *  block,
int  stride,
const uint8_t  nnzc[15 *8] 
)
static

Definition at line 316 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 345 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 438 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 449 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 469 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 573 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 590 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 602 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 648 of file h264_altivec.c.

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

Definition at line 725 of file h264_altivec.c.

Referenced by ff_h264dsp_init().