--- xvid.c 2009/06/02 13:06:49 1.81 +++ xvid.c 2011/02/14 17:21:00 1.85.2.2 @@ -4,6 +4,7 @@ * - Native API implementation - * * Copyright(C) 2001-2004 Peter Ross + * 2002-2010 Michael Militzer * * 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 @@ -19,7 +20,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: xvid.c,v 1.81 2009/06/02 13:06:49 Isibaar Exp $ + * $Id: xvid.c,v 1.85.2.2 2011/02/14 17:21:00 Isibaar Exp $ * ****************************************************************************/ @@ -43,6 +44,11 @@ #endif #endif +#if defined(__amigaos4__) +#include +#include +#endif + #include "xvid.h" #include "decoder.h" #include "encoder.h" @@ -69,7 +75,7 @@ #if (defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)) && defined(_MSC_VER) # include -#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || defined(ARCH_IS_PPC) +#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || (defined(ARCH_IS_PPC) && !defined(__amigaos4__)) # include # include @@ -82,7 +88,6 @@ } #endif - /* * Calls the funcptr, and returns whether SIGILL (illegal instruction) was * signalled @@ -105,7 +110,7 @@ } return(0); } -#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || defined(ARCH_IS_PPC) +#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || (defined(ARCH_IS_PPC) && !defined(__amigaos4__)) static int sigill_check(void (*func)()) { @@ -157,16 +162,26 @@ #endif #if defined(ARCH_IS_PPC) +#if defined(__amigaos4__) + { + uint32_t vector_unit = VECTORTYPE_NONE; + IExec->GetCPUInfoTags(GCIT_VectorUnit, &vector_unit, TAG_END); + if (vector_unit == VECTORTYPE_ALTIVEC) { + cpu_flags |= XVID_CPU_ALTIVEC; + } + } +#else if (!sigill_check(altivec_trigger)) cpu_flags |= XVID_CPU_ALTIVEC; #endif +#endif return cpu_flags; } /***************************************************************************** - * XviD Init Entry point + * Xvid Init Entry point * * Well this function initialize all internal function pointers according * to the CPU features forced by the library client or autodetected (depending @@ -314,15 +329,19 @@ yv12_to_uyvyi = yv12_to_uyvyi_c; /* Functions used in motion estimation algorithms */ - calc_cbp = calc_cbp_c; - sad16 = sad16_c; - sad8 = sad8_c; - sad16bi = sad16bi_c; - sad8bi = sad8bi_c; - dev16 = dev16_c; - sad16v = sad16v_c; - sse8_16bit = sse8_16bit_c; - sse8_8bit = sse8_8bit_c; + calc_cbp = calc_cbp_c; + sad16 = sad16_c; + sad8 = sad8_c; + sad16bi = sad16bi_c; + sad8bi = sad8bi_c; + dev16 = dev16_c; + sad16v = sad16v_c; + sse8_16bit = sse8_16bit_c; + sse8_8bit = sse8_8bit_c; + + sseh8_16bit = sseh8_16bit_c; + coeff8_energy = coeff8_energy_c; + blocksum8 = blocksum8_c; init_GMC(cpu_flags); @@ -552,8 +571,13 @@ dequant_h263_inter = dequant_h263_inter_sse2; /* SAD operators */ - sad16 = sad16_sse2; - dev16 = dev16_sse2; + sad16 = sad16_sse2; + dev16 = dev16_sse2; + + /* PSNR-HVS-M distortion metric */ + sseh8_16bit = sseh8_16bit_sse2; + coeff8_energy = coeff8_energy_sse2; + blocksum8 = blocksum8_sse2; /* DCT operators */ fdct = fdct_sse2_skal; @@ -676,7 +700,7 @@ return XVID_ERR_VERSION; info->actual_version = XVID_VERSION; - info->build = "xvid-1.3.0-dev"; + info->build = "xvid-1.3.0"; info->cpu_flags = detect_cpu_flags(); info->num_threads = 0; /* single-thread */ @@ -707,6 +731,14 @@ info -> num_threads = 1; } +#elif defined(__amigaos4__) + + { + uint32_t num_threads = 1; + IExec->GetCPUInfoTags(GCIT_NumberOfCPUs, &num_threads, TAG_END); + info->num_threads = num_threads; + } + #endif return 0; @@ -743,6 +775,15 @@ (uint8_t**)convert->output.plane, convert->output.stride, convert->output.csp, convert->interlacing); break; + + case XVID_CSP_INTERNAL : + img.y = (uint8_t*)convert->input.plane[0]; + img.u = (uint8_t*)convert->input.plane[1]; + img.v = (uint8_t*)convert->input.plane[2]; + image_output(&img, width, height, convert->input.stride[0], + (uint8_t**)convert->output.plane, convert->output.stride, + convert->output.csp, convert->interlacing); + break; default : return XVID_ERR_FORMAT; @@ -754,7 +795,7 @@ } /***************************************************************************** - * XviD Global Entry point + * Xvid Global Entry point * * Well this function initialize all internal function pointers according * to the CPU features forced by the library client or autodetected (depending @@ -787,7 +828,7 @@ } /***************************************************************************** - * XviD Native decoder entry point + * Xvid Native decoder entry point * * This function is just a wrapper to all the option cases. * @@ -819,7 +860,7 @@ /***************************************************************************** - * XviD Native encoder entry point + * Xvid Native encoder entry point * * This function is just a wrapper to all the option cases. *