2001-09-16 21:54:00 +00:00
|
|
|
/*
|
|
|
|
* Sun mediaLib optimized DSP utils
|
2009-01-19 15:46:40 +00:00
|
|
|
* Copyright (c) 2001 Fabrice Bellard
|
2001-09-16 21:54:00 +00:00
|
|
|
*
|
2011-03-18 17:35:10 +00:00
|
|
|
* This file is part of Libav.
|
2006-10-07 15:30:46 +00:00
|
|
|
*
|
2011-03-18 17:35:10 +00:00
|
|
|
* Libav is free software; you can redistribute it and/or
|
2002-05-25 22:45:33 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 15:30:46 +00:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2001-09-16 21:54:00 +00:00
|
|
|
*
|
2011-03-18 17:35:10 +00:00
|
|
|
* Libav is distributed in the hope that it will be useful,
|
2001-09-16 21:54:00 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2002-05-25 22:45:33 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2001-09-16 21:54:00 +00:00
|
|
|
*
|
2002-05-25 22:45:33 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2011-03-18 17:35:10 +00:00
|
|
|
* License along with Libav; if not, write to the Free Software
|
2006-01-12 22:43:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2001-09-16 21:54:00 +00:00
|
|
|
*/
|
|
|
|
|
2008-05-09 11:56:36 +00:00
|
|
|
#include "libavcodec/dsputil.h"
|
|
|
|
#include "libavcodec/mpegvideo.h"
|
2001-09-16 21:54:00 +00:00
|
|
|
|
|
|
|
#include <mlib_types.h>
|
|
|
|
#include <mlib_status.h>
|
|
|
|
#include <mlib_sys.h>
|
2003-10-11 16:43:51 +00:00
|
|
|
#include <mlib_algebra.h>
|
2001-09-16 21:54:00 +00:00
|
|
|
#include <mlib_video.h>
|
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
/* misc */
|
2001-09-16 21:54:00 +00:00
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
static void get_pixels_mlib(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i=0;i<8;i++) {
|
|
|
|
mlib_VectorConvert_S16_U8_Mod((mlib_s16 *)block, (mlib_u8 *)pixels, 8);
|
|
|
|
|
|
|
|
pixels += line_size;
|
|
|
|
block += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void diff_pixels_mlib(DCTELEM *restrict block, const uint8_t *s1, const uint8_t *s2, int line_size)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i=0;i<8;i++) {
|
|
|
|
mlib_VectorSub_S16_U8_Mod((mlib_s16 *)block, (mlib_u8 *)s1, (mlib_u8 *)s2, 8);
|
|
|
|
|
|
|
|
s1 += line_size;
|
|
|
|
s2 += line_size;
|
|
|
|
block += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_pixels_clamped_mlib(const DCTELEM *block, uint8_t *pixels, int line_size)
|
|
|
|
{
|
|
|
|
mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* put block, width 16 pixel, height 8/16 */
|
2002-10-08 12:09:23 +00:00
|
|
|
|
|
|
|
static void put_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2002-10-08 12:09:23 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 8:
|
|
|
|
mlib_VideoCopyRef_U8_U8_16x8(dest, (uint8_t *)ref, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoCopyRef_U8_U8_16x16(dest, (uint8_t *)ref, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2002-10-08 12:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void put_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2002-10-08 12:09:23 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpX_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2002-10-08 12:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void put_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2002-10-08 12:09:23 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2002-10-08 12:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void put_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2002-10-08 12:09:23 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpXY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2002-10-08 12:09:23 +00:00
|
|
|
}
|
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
/* put block, width 8 pixel, height 4/8/16 */
|
2002-10-08 12:09:23 +00:00
|
|
|
|
|
|
|
static void put_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 4:
|
|
|
|
mlib_VideoCopyRef_U8_U8_8x4(dest, (uint8_t *)ref, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
mlib_VideoCopyRef_U8_U8_8x8(dest, (uint8_t *)ref, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
|
|
|
|
2002-10-08 12:09:23 +00:00
|
|
|
static void put_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 4:
|
|
|
|
mlib_VideoInterpX_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpX_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
|
|
|
|
2002-10-08 12:09:23 +00:00
|
|
|
static void put_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 4:
|
|
|
|
mlib_VideoInterpY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
|
|
|
|
2002-10-08 12:09:23 +00:00
|
|
|
static void put_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 4:
|
|
|
|
mlib_VideoInterpXY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpXY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
/* average block, width 16 pixel, height 8/16 */
|
2002-10-08 12:09:23 +00:00
|
|
|
|
|
|
|
static void avg_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2002-10-08 12:09:23 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 8:
|
|
|
|
mlib_VideoCopyRefAve_U8_U8_16x8(dest, (uint8_t *)ref, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoCopyRefAve_U8_U8_16x16(dest, (uint8_t *)ref, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2002-10-08 12:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void avg_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2002-10-08 12:09:23 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpAveX_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpAveX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2002-10-08 12:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void avg_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2002-10-08 12:09:23 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpAveY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpAveY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2002-10-08 12:09:23 +00:00
|
|
|
}
|
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
static void avg_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2002-10-08 12:09:23 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpAveXY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpAveXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2002-10-08 12:09:23 +00:00
|
|
|
}
|
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
/* average block, width 8 pixel, height 4/8/16 */
|
2002-10-08 12:09:23 +00:00
|
|
|
|
|
|
|
static void avg_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 4:
|
|
|
|
mlib_VideoCopyRefAve_U8_U8_8x4(dest, (uint8_t *)ref, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
mlib_VideoCopyRefAve_U8_U8_8x8(dest, (uint8_t *)ref, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
|
|
|
|
2002-10-08 12:09:23 +00:00
|
|
|
static void avg_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 4:
|
|
|
|
mlib_VideoInterpAveX_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpAveX_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
|
|
|
|
2002-10-08 12:09:23 +00:00
|
|
|
static void avg_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 4:
|
|
|
|
mlib_VideoInterpAveY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpAveY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
static void avg_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
|
2005-12-22 01:10:11 +00:00
|
|
|
int stride, int height)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
switch (height) {
|
|
|
|
case 4:
|
|
|
|
mlib_VideoInterpAveXY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
mlib_VideoInterpAveXY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
/* swap byte order of a buffer */
|
2001-09-16 21:54:00 +00:00
|
|
|
|
2008-02-01 13:49:15 +00:00
|
|
|
static void bswap_buf_mlib(uint32_t *dst, const uint32_t *src, int w)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
mlib_VectorReverseByteOrder_U32_U32(dst, src, w);
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
/* transformations */
|
2002-10-08 12:09:23 +00:00
|
|
|
|
2003-02-11 16:35:48 +00:00
|
|
|
static void ff_idct_put_mlib(uint8_t *dest, int line_size, DCTELEM *data)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2003-10-11 16:43:51 +00:00
|
|
|
int i;
|
2006-11-12 20:08:09 +00:00
|
|
|
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
|
2003-10-11 16:43:51 +00:00
|
|
|
|
2001-09-16 21:54:00 +00:00
|
|
|
mlib_VideoIDCT8x8_S16_S16 (data, data);
|
2005-12-17 18:14:38 +00:00
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
for(i=0;i<8;i++) {
|
|
|
|
dest[0] = cm[data[0]];
|
|
|
|
dest[1] = cm[data[1]];
|
|
|
|
dest[2] = cm[data[2]];
|
|
|
|
dest[3] = cm[data[3]];
|
|
|
|
dest[4] = cm[data[4]];
|
|
|
|
dest[5] = cm[data[5]];
|
|
|
|
dest[6] = cm[data[6]];
|
|
|
|
dest[7] = cm[data[7]];
|
|
|
|
|
|
|
|
dest += line_size;
|
|
|
|
data += 8;
|
|
|
|
}
|
2002-10-06 15:27:01 +00:00
|
|
|
}
|
2002-10-08 12:09:23 +00:00
|
|
|
|
2003-02-11 16:35:48 +00:00
|
|
|
static void ff_idct_add_mlib(uint8_t *dest, int line_size, DCTELEM *data)
|
2002-10-06 15:27:01 +00:00
|
|
|
{
|
|
|
|
mlib_VideoIDCT8x8_S16_S16 (data, data);
|
2002-12-15 22:42:59 +00:00
|
|
|
mlib_VideoAddBlock_U8_S16(dest, (mlib_s16 *)data, line_size);
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 01:21:01 +00:00
|
|
|
static void ff_idct_mlib(DCTELEM *data)
|
2003-06-21 01:11:31 +00:00
|
|
|
{
|
|
|
|
mlib_VideoIDCT8x8_S16_S16 (data, data);
|
|
|
|
}
|
|
|
|
|
2002-10-08 12:09:23 +00:00
|
|
|
static void ff_fdct_mlib(DCTELEM *data)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
|
|
|
mlib_VideoDCT8x8_S16_S16 (data, data);
|
|
|
|
}
|
|
|
|
|
2003-05-20 17:36:49 +00:00
|
|
|
void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx)
|
2001-09-16 21:54:00 +00:00
|
|
|
{
|
2011-07-21 09:05:15 +00:00
|
|
|
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
|
2011-03-29 15:48:59 +00:00
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
c->diff_pixels = diff_pixels_mlib;
|
|
|
|
c->add_pixels_clamped = add_pixels_clamped_mlib;
|
|
|
|
|
2011-03-29 15:48:59 +00:00
|
|
|
if (!high_bit_depth) {
|
2011-07-21 01:31:57 +00:00
|
|
|
c->get_pixels = get_pixels_mlib;
|
|
|
|
|
2002-11-11 10:04:45 +00:00
|
|
|
c->put_pixels_tab[0][0] = put_pixels16_mlib;
|
|
|
|
c->put_pixels_tab[0][1] = put_pixels16_x2_mlib;
|
|
|
|
c->put_pixels_tab[0][2] = put_pixels16_y2_mlib;
|
|
|
|
c->put_pixels_tab[0][3] = put_pixels16_xy2_mlib;
|
|
|
|
c->put_pixels_tab[1][0] = put_pixels8_mlib;
|
|
|
|
c->put_pixels_tab[1][1] = put_pixels8_x2_mlib;
|
|
|
|
c->put_pixels_tab[1][2] = put_pixels8_y2_mlib;
|
|
|
|
c->put_pixels_tab[1][3] = put_pixels8_xy2_mlib;
|
|
|
|
|
|
|
|
c->avg_pixels_tab[0][0] = avg_pixels16_mlib;
|
|
|
|
c->avg_pixels_tab[0][1] = avg_pixels16_x2_mlib;
|
|
|
|
c->avg_pixels_tab[0][2] = avg_pixels16_y2_mlib;
|
|
|
|
c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mlib;
|
|
|
|
c->avg_pixels_tab[1][0] = avg_pixels8_mlib;
|
|
|
|
c->avg_pixels_tab[1][1] = avg_pixels8_x2_mlib;
|
|
|
|
c->avg_pixels_tab[1][2] = avg_pixels8_y2_mlib;
|
|
|
|
c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mlib;
|
|
|
|
|
|
|
|
c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mlib;
|
|
|
|
c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib;
|
2011-03-29 15:48:59 +00:00
|
|
|
}
|
2002-11-11 10:04:45 +00:00
|
|
|
|
2003-10-11 16:43:51 +00:00
|
|
|
c->bswap_buf = bswap_buf_mlib;
|
2001-09-16 21:54:00 +00:00
|
|
|
}
|
2002-08-30 18:17:20 +00:00
|
|
|
|
|
|
|
void MPV_common_init_mlib(MpegEncContext *s)
|
|
|
|
{
|
|
|
|
if(s->avctx->dct_algo==FF_DCT_AUTO || s->avctx->dct_algo==FF_DCT_MLIB){
|
2005-12-22 01:10:11 +00:00
|
|
|
s->dsp.fdct = ff_fdct_mlib;
|
2002-08-30 18:17:20 +00:00
|
|
|
}
|
2002-10-06 15:27:01 +00:00
|
|
|
|
2008-04-02 11:47:00 +00:00
|
|
|
if(s->avctx->idct_algo==FF_IDCT_MLIB){
|
2003-05-20 17:36:49 +00:00
|
|
|
s->dsp.idct_put= ff_idct_put_mlib;
|
|
|
|
s->dsp.idct_add= ff_idct_add_mlib;
|
2003-06-21 01:11:31 +00:00
|
|
|
s->dsp.idct = ff_idct_mlib;
|
2003-05-20 17:36:49 +00:00
|
|
|
s->dsp.idct_permutation_type= FF_NO_IDCT_PERM;
|
2002-10-06 15:27:01 +00:00
|
|
|
}
|
2002-08-30 18:17:20 +00:00
|
|
|
}
|