Spaces:
Runtime error
Runtime error
/* | |
* Alpha optimized DSP utils | |
* Copyright (c) 2002 Falk Hueffner <[email protected]> | |
* | |
* This file is part of FFmpeg. | |
* | |
* FFmpeg is free software; you can redistribute it and/or | |
* modify it under the terms of the GNU Lesser General Public | |
* License as published by the Free Software Foundation; either | |
* version 2.1 of the License, or (at your option) any later version. | |
* | |
* FFmpeg 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 | |
* Lesser General Public License for more details. | |
* | |
* You should have received a copy of the GNU Lesser General Public | |
* License along with FFmpeg; if not, write to the Free Software | |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
*/ | |
static inline uint64_t avg2_no_rnd(uint64_t a, uint64_t b) | |
{ | |
return (a & b) + (((a ^ b) & BYTE_VEC(0xfe)) >> 1); | |
} | |
static inline uint64_t avg2(uint64_t a, uint64_t b) | |
{ | |
return (a | b) - (((a ^ b) & BYTE_VEC(0xfe)) >> 1); | |
} | |
/* The XY2 routines basically utilize this scheme, but reuse parts in | |
each iteration. */ | |
static inline uint64_t avg4(uint64_t l1, uint64_t l2, uint64_t l3, uint64_t l4) | |
{ | |
uint64_t r1 = ((l1 & ~BYTE_VEC(0x03)) >> 2) | |
+ ((l2 & ~BYTE_VEC(0x03)) >> 2) | |
+ ((l3 & ~BYTE_VEC(0x03)) >> 2) | |
+ ((l4 & ~BYTE_VEC(0x03)) >> 2); | |
uint64_t r2 = (( (l1 & BYTE_VEC(0x03)) | |
+ (l2 & BYTE_VEC(0x03)) | |
+ (l3 & BYTE_VEC(0x03)) | |
+ (l4 & BYTE_VEC(0x03)) | |
+ BYTE_VEC(0x02)) >> 2) & BYTE_VEC(0x03); | |
return r1 + r2; | |
} | |
/* Rounding primitives. */ | |
PIXOP(put, STORE); | |
PIXOP(avg, STORE); | |
/* Not rounding primitives. */ | |
PIXOP(put_no_rnd, STORE); | |
PIXOP(avg_no_rnd, STORE); | |
static void put_pixels16_axp_asm(uint8_t *block, const uint8_t *pixels, | |
ptrdiff_t line_size, int h) | |
{ | |
put_pixels_axp_asm(block, pixels, line_size, h); | |
put_pixels_axp_asm(block + 8, pixels + 8, line_size, h); | |
} | |
av_cold void ff_hpeldsp_init_alpha(HpelDSPContext *c, int flags) | |
{ | |
c->put_pixels_tab[0][0] = put_pixels16_axp_asm; | |
c->put_pixels_tab[0][1] = put_pixels16_x2_axp; | |
c->put_pixels_tab[0][2] = put_pixels16_y2_axp; | |
c->put_pixels_tab[0][3] = put_pixels16_xy2_axp; | |
c->put_no_rnd_pixels_tab[0][0] = put_pixels16_axp_asm; | |
c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_axp; | |
c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_axp; | |
c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_axp; | |
c->avg_pixels_tab[0][0] = avg_pixels16_axp; | |
c->avg_pixels_tab[0][1] = avg_pixels16_x2_axp; | |
c->avg_pixels_tab[0][2] = avg_pixels16_y2_axp; | |
c->avg_pixels_tab[0][3] = avg_pixels16_xy2_axp; | |
c->avg_no_rnd_pixels_tab[0] = avg_no_rnd_pixels16_axp; | |
c->avg_no_rnd_pixels_tab[1] = avg_no_rnd_pixels16_x2_axp; | |
c->avg_no_rnd_pixels_tab[2] = avg_no_rnd_pixels16_y2_axp; | |
c->avg_no_rnd_pixels_tab[3] = avg_no_rnd_pixels16_xy2_axp; | |
c->put_pixels_tab[1][0] = put_pixels_axp_asm; | |
c->put_pixels_tab[1][1] = put_pixels_x2_axp; | |
c->put_pixels_tab[1][2] = put_pixels_y2_axp; | |
c->put_pixels_tab[1][3] = put_pixels_xy2_axp; | |
c->put_no_rnd_pixels_tab[1][0] = put_pixels_axp_asm; | |
c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels_x2_axp; | |
c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels_y2_axp; | |
c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels_xy2_axp; | |
c->avg_pixels_tab[1][0] = avg_pixels_axp; | |
c->avg_pixels_tab[1][1] = avg_pixels_x2_axp; | |
c->avg_pixels_tab[1][2] = avg_pixels_y2_axp; | |
c->avg_pixels_tab[1][3] = avg_pixels_xy2_axp; | |
} | |