⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 motion_comp.c

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 C
📖 第 1 页 / 共 3 页
字号:
/* * motion_comp.c * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org> * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> * * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. * See http://libmpeg2.sourceforge.net/ for updates. * * mpeg2dec 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. * * mpeg2dec 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-1307  USA */#include "config.h"#include <inttypes.h>#include "mpeg2.h"#include "attributes.h"#include "mpeg2_internal.h"mpeg2_mc_t mpeg2_mc;uint8_t LumaData[4 * 64] = {0};uint8_t ChromaData[2 * 64] = {0};uint8_t ChromaOffset = 0;uint8_t LumaOffset = 0;void mpeg2_mc_init (uint32_t accel){#ifdef ARCH_X86    if (accel & MPEG2_ACCEL_X86_MMXEXT)	mpeg2_mc = mpeg2_mc_mmxext;    else if (accel & MPEG2_ACCEL_X86_3DNOW)	mpeg2_mc = mpeg2_mc_3dnow;    else if (accel & MPEG2_ACCEL_X86_MMX)	mpeg2_mc = mpeg2_mc_mmx;    else#endif#ifdef ARCH_PPC    if (accel & MPEG2_ACCEL_PPC_ALTIVEC)	mpeg2_mc = mpeg2_mc_altivec;    else#endif#ifdef ARCH_ALPHA    if (accel & MPEG2_ACCEL_ALPHA)	mpeg2_mc = mpeg2_mc_alpha;    else#endif#ifdef ARCH_SPARC    if (accel & MPEG2_ACCEL_SPARC_VIS)	mpeg2_mc = mpeg2_mc_vis;    else#endif	mpeg2_mc = mpeg2_mc_c;}#define avg2(a,b) ((a+b+1)>>1)#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)#define predict_o(i) (ref[i])#define predict_x(i) (avg2 (ref[i], ref[i+1]))#define predict_y(i) (avg2 (ref[i], (ref+stride)[i]))#define predict_xy(i) (avg4 (ref[i], ref[i+1], \			     (ref+stride)[i], (ref+stride)[i+1]))#define put(predictor,i) dest[i] = predictor (i)#define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i])/* mc function template */static voidMC_put_o_16_c (uint8_t * dest, const uint8_t * ref, const int stride,	       int height){	int x,y,z;	x = 0;	y = 0;	z = 0;  do    {      dest[0] = (ref[0]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[0];	  x++;      dest[1] = (ref[1]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[1];	  x++;      dest[2] = (ref[2]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[2];	  x++;      dest[3] = (ref[3]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[3];	  x++;      dest[4] = (ref[4]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[4];	  x++;      dest[5] = (ref[5]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[5];	  x++;      dest[6] = (ref[6]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[6];	  x++;      dest[7] = (ref[7]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[7];	  x++;	  y+=8;	  x=0;      dest[8] = (ref[8]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[8];	  x++;      dest[9] = (ref[9]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[9];	  x++;      dest[10] = (ref[10]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[10];	  x++;      dest[11] = (ref[11]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[11];	  x++;      dest[12] = (ref[12]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[12];	  x++;      dest[13] = (ref[13]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[13];	  x++;      dest[14] = (ref[14]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[14];	  x++;      dest[15] = (ref[15]);	  LumaData[LumaOffset + x + y * 8 + z * 8] = dest[15];	  x++;	  x=0;	  y-=8;	  z+=1;	  z = (z == 8) ? 16 : z;      ref += stride;      dest += stride;    }  while (--height);}static voidMC_put_o_8_c (uint8_t * dest, const uint8_t * ref, const int stride,	      int height){	int x;	x = 0;  do    {      ChromaData[ChromaOffset + x++] = dest[0] = (ref[0]);      ChromaData[ChromaOffset + x++] = dest[1] = (ref[1]);      ChromaData[ChromaOffset + x++] = dest[2] = (ref[2]);      ChromaData[ChromaOffset + x++] = dest[3] = (ref[3]);      ChromaData[ChromaOffset + x++] = dest[4] = (ref[4]);      ChromaData[ChromaOffset + x++] = dest[5] = (ref[5]);      ChromaData[ChromaOffset + x++] = dest[6] = (ref[6]);      ChromaData[ChromaOffset + x++] = dest[7] = (ref[7]);      ref += stride;      dest += stride;    }  while (--height);}static voidMC_avg_o_16_c (uint8_t * dest, const uint8_t * ref, const int stride,	       int height){	int x,y,z;	x = 0;	y = 0;	z = 0;  do    {	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[0]));	  x++;      dest[0] = (((ref[0]) + dest[0] + 1) >> 1);	  	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[1]));	  x++;      	  dest[1] = (((ref[1]) + dest[1] + 1) >> 1);	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[2]));	  x++;      	  dest[2] = (((ref[2]) + dest[2] + 1) >> 1);	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[3]));	  x++;      	  dest[3] = (((ref[3]) + dest[3] + 1) >> 1);	  	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[4]));	  x++;      	  dest[4] = (((ref[4]) + dest[4] + 1) >> 1);      	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[5]));	  x++;	  	  dest[5] = (((ref[5]) + dest[5] + 1) >> 1);      	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[6]));	  x++;	  	  dest[6] = (((ref[6]) + dest[6] + 1) >> 1);      	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[7]));	  x++;	  dest[7] = (((ref[7]) + dest[7] + 1) >> 1);      	  y+=8;	  x=0;	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[8]));	  x++;	  dest[8] = (((ref[8]) + dest[8] + 1) >> 1);	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[9]));	  x++;      	  dest[9] = (((ref[9]) + dest[9] + 1) >> 1);      	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[10]));	  x++;	  dest[10] = (((ref[10]) + dest[10] + 1) >> 1);	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[11]));	  x++;      	  dest[11] = (((ref[11]) + dest[11] + 1) >> 1);      	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[12]));	  x++;	  dest[12] = (((ref[12]) + dest[12] + 1) >> 1);      	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[13]));	  x++;	  dest[13] = (((ref[13]) + dest[13] + 1) >> 1);	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[14]));	  x++;      	  dest[14] = (((ref[14]) + dest[14] + 1) >> 1);      	  LumaData[LumaOffset + x + y * 8 + z * 8] = ((ref[15]));	  x++;	  dest[15] = (((ref[15]) + dest[15] + 1) >> 1);      	  x = 0;	  y = 0;	  z+=1;	  z = (z == 8) ? 16 : z;	  ref += stride;      dest += stride;    }  while (--height);}static voidMC_avg_o_8_c (uint8_t * dest, const uint8_t * ref, const int stride,	      int height){	int x;	x = 0;  do    {	  ChromaData[ChromaOffset + x++] = ((ref[0]));      dest[0] = (((ref[0]) + dest[0] + 1) >> 1);	  ChromaData[ChromaOffset + x++] = ((ref[1]));      dest[1] = (((ref[1]) + dest[1] + 1) >> 1);	  ChromaData[ChromaOffset + x++] = ((ref[2]));      dest[2] = (((ref[2]) + dest[2] + 1) >> 1);	  ChromaData[ChromaOffset + x++] = ((ref[3]));      dest[3] = (((ref[3]) + dest[3] + 1) >> 1);	  ChromaData[ChromaOffset + x++] = ((ref[4]));      dest[4] = (((ref[4]) + dest[4] + 1) >> 1);	  ChromaData[ChromaOffset + x++] = ((ref[5]));      dest[5] = (((ref[5]) + dest[5] + 1) >> 1);	  ChromaData[ChromaOffset + x++] = ((ref[6]));      dest[6] = (((ref[6]) + dest[6] + 1) >> 1);	  ChromaData[ChromaOffset + x++] = ((ref[7]));      dest[7] = (((ref[7]) + dest[7] + 1) >> 1);      ref += stride;      dest += stride;    }  while (--height);}static voidMC_put_x_16_c (uint8_t * dest, const uint8_t * ref, const int stride,	       int height){	int x,y,z;	x = y = z = 0;  do    {      LumaData[LumaOffset + x + y * 8 + z * 8] = (((ref[0] + ref[0 + 1] + 1) >> 1)); x++;      dest[0] = (((ref[0] + ref[0 + 1] + 1) >> 1));	  LumaData[LumaOffset + x + y * 8 + z * 8] = (((ref[1] + ref[1 + 1] + 1) >> 1)); x++;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -