]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/alpha/dsputil_alpha.c
Merge commit 'b9ba5253dd1232be4b48cfe61c31ff4b3de3d10a'
[ffmpeg] / libavcodec / alpha / dsputil_alpha.c
index 5e9196db466d263bf8438222f8b80cb77b668fe7..cb62665a554e650c45a8260b1687daabe6d74358 100644 (file)
@@ -2,23 +2,24 @@
  * Alpha optimized DSP utils
  * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
  *
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * 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.
  *
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/attributes.h"
 #include "libavcodec/dsputil.h"
 #include "dsputil_alpha.h"
 #include "asm.h"
@@ -32,7 +33,7 @@ void (*add_pixels_clamped_axp_p)(const int16_t *block, uint8_t *pixels,
 /* These functions were the base for the optimized assembler routines,
    and remain here for documentation purposes.  */
 static void put_pixels_clamped_mvi(const int16_t *block, uint8_t *pixels,
-                                   int line_size)
+                                   ptrdiff_t line_size)
 {
     int i = 8;
     uint64_t clampmask = zap(-1, 0xaa); /* 0x00ff00ff00ff00ff */
@@ -56,7 +57,7 @@ static void put_pixels_clamped_mvi(const int16_t *block, uint8_t *pixels,
 }
 
 void add_pixels_clamped_mvi(const int16_t *block, uint8_t *pixels,
-                            int line_size)
+                            ptrdiff_t line_size)
 {
     int h = 8;
     /* Keep this function a leaf function by generating the constants
@@ -212,7 +213,7 @@ static inline uint64_t avg4(uint64_t l1, uint64_t l2, uint64_t l3, uint64_t l4)
 #define MAKE_OP(OPNAME, SUFF, OPKIND, STORE)                                \
 static void OPNAME ## _pixels ## SUFF ## _axp                               \
         (uint8_t *restrict block, const uint8_t *restrict pixels,           \
-         int line_size, int h)                                              \
+         ptrdiff_t line_size, int h)                                        \
 {                                                                           \
     if ((size_t) pixels & 0x7) {                                            \
         OPKIND(uldq, STORE);                                                \
@@ -223,7 +224,7 @@ static void OPNAME ## _pixels ## SUFF ## _axp                               \
                                                                             \
 static void OPNAME ## _pixels16 ## SUFF ## _axp                             \
         (uint8_t *restrict block, const uint8_t *restrict pixels,           \
-         int line_size, int h)                                              \
+         ptrdiff_t line_size, int h)                                        \
 {                                                                           \
     OPNAME ## _pixels ## SUFF ## _axp(block,     pixels,     line_size, h); \
     OPNAME ## _pixels ## SUFF ## _axp(block + 8, pixels + 8, line_size, h); \
@@ -262,13 +263,13 @@ PIXOP(put_no_rnd, STORE);
 PIXOP(avg_no_rnd, STORE);
 
 static void put_pixels16_axp_asm(uint8_t *block, const uint8_t *pixels,
-                                 int line_size, int h)
+                                 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);
 }
 
-void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
+av_cold void ff_dsputil_init_alpha(DSPContext *c, AVCodecContext *avctx)
 {
     const int high_bit_depth = avctx->bits_per_raw_sample > 8;
 
@@ -288,10 +289,10 @@ void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
     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][0] = avg_no_rnd_pixels16_axp;
-    c->avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_axp;
-    c->avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_axp;
-    c->avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_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;
@@ -331,7 +332,7 @@ void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
     put_pixels_clamped_axp_p = c->put_pixels_clamped;
     add_pixels_clamped_axp_p = c->add_pixels_clamped;
 
-    if (avctx->bits_per_raw_sample <= 8 &&
+    if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
         (avctx->idct_algo == FF_IDCT_AUTO ||
          avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) {
         c->idct_put = ff_simple_idct_put_axp;