📄 pixel.c
字号:
/***************************************************************************** * pixel.c: h264 encoder ***************************************************************************** * Copyright (C) 2003 Laurent Aimar * $Id: pixel.c,v 1.1 2004/03/09 12:27:13 titer Exp $ * * Authors: Eric Petit <titer@m0k.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdint.h>#include "../pixel.h"#include "pixel.h"static int pixel_sad_16x16_altivec( uint8_t *pix1, int i_stride_pix1, uint8_t *pix2, int i_stride_pix2 ){ int y; unsigned int sum __attribute__((aligned(16))); vector unsigned char pix1v, pix2v; vector unsigned int zero = vec_splat_u32( 0 ); vector unsigned int sumv = zero; for( y = 0; y < 16; y++ ) { /* Read unaligned data */ pix1v = vec_perm( vec_ld( 0, pix1 ), vec_ld( 16, pix1 ), vec_lvsl( 0, pix1 ) ); pix2v = vec_perm( vec_ld( 0, pix2 ), vec_ld( 16, pix2 ), vec_lvsl( 0, pix2 ) ); sumv = vec_sum4s( vec_sub( vec_max( pix1v, pix2v ), vec_min( pix1v, pix2v ) ), sumv ); pix1 += i_stride_pix1; pix2 += i_stride_pix2; } sumv = (vector unsigned int) vec_sums( (vector signed int) sumv, (vector signed int) zero ); vec_ste( vec_splat( sumv, 3 ), 0, &sum ); return sum;}/**************************************************************************** * x264_pixel_init: ****************************************************************************/void x264_pixel_altivec_init( x264_pixel_function_t *pixf ){ pixf->sad[PIXEL_16x16] = pixel_sad_16x16_altivec;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -