FFmpeg
pixelutils_msa.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Parag Salasakar (Parag.Salasakar@imgtec.com)
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <stddef.h>
22 #include <stdint.h>
23 
24 #include "generic_macros_msa.h"
25 #include "pixelutils.h"
26 
27 int ff_pixelutils_sad16_msa(const uint8_t *src, ptrdiff_t src_stride,
28  const uint8_t *ref, ptrdiff_t ref_stride)
29 {
30  int32_t ht_cnt = 16/4;
31  v16u8 src0, src1, ref0, ref1;
32  v8u16 sad = { 0 };
33 
34  for (; ht_cnt--; ) {
35  LD_UB2(src, src_stride, src0, src1);
36  src += (2 * src_stride);
37  LD_UB2(ref, ref_stride, ref0, ref1);
38  ref += (2 * ref_stride);
39  sad += SAD_UB2_UH(src0, src1, ref0, ref1);
40 
41  LD_UB2(src, src_stride, src0, src1);
42  src += (2 * src_stride);
43  LD_UB2(ref, ref_stride, ref0, ref1);
44  ref += (2 * ref_stride);
45  sad += SAD_UB2_UH(src0, src1, ref0, ref1);
46  }
47  return (HADD_UH_U32(sad));
48 }
src1
const pixel * src1
Definition: h264pred_template.c:420
HADD_UH_U32
#define HADD_UH_U32(in)
Definition: generic_macros_msa.h:1017
generic_macros_msa.h
LD_UB2
#define LD_UB2(...)
Definition: generic_macros_msa.h:277
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
src0
const pixel *const src0
Definition: h264pred_template.c:419
ff_pixelutils_sad16_msa
int ff_pixelutils_sad16_msa(const uint8_t *src, ptrdiff_t src_stride, const uint8_t *ref, ptrdiff_t ref_stride)
Definition: pixelutils_msa.c:27
pixelutils.h
int32_t
int32_t
Definition: audioconvert.c:56
SAD_UB2_UH
#define SAD_UB2_UH(in0, in1, ref0, ref1)
Definition: generic_macros_msa.h:1118
src
#define src
Definition: vp8dsp.c:248