]> git.sesse.net Git - x264/blobdiff - common/pixel.h
aarch64: Remove commas LLVM's assembler complains about
[x264] / common / pixel.h
index 8d31b7c27149dc1f8948e24ddae08ddb29635d17..979ffa7ba810ca8b7a08232f377f52b126763ba9 100644 (file)
@@ -1,10 +1,11 @@
 /*****************************************************************************
  * pixel.c: pixel metrics
  *****************************************************************************
- * Copyright (C) 2004-2011 x264 project
+ * Copyright (C) 2004-2015 x264 project
  *
  * Authors: Loren Merritt <lorenm@u.washington.edu>
  *          Fiona Glaser <fiona@x264.com>
+            Henrik Gramner <henrik@gramner.com>
  *
  * 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
@@ -29,9 +30,9 @@
 
 // SSD assumes all args aligned
 // other cmp functions assume first arg aligned
-typedef int  (*x264_pixel_cmp_t) ( pixel *, int, pixel *, int );
-typedef void (*x264_pixel_cmp_x3_t) ( pixel *, pixel *, pixel *, pixel *, int, int[3] );
-typedef void (*x264_pixel_cmp_x4_t) ( pixel *, pixel *, pixel *, pixel *, pixel *, int, int[4] );
+typedef int  (*x264_pixel_cmp_t) ( pixel *, intptr_t, pixel *, intptr_t );
+typedef void (*x264_pixel_cmp_x3_t) ( pixel *, pixel *, pixel *, pixel *, intptr_t, int[3] );
+typedef void (*x264_pixel_cmp_x4_t) ( pixel *, pixel *, pixel *, pixel *, pixel *, intptr_t, int[4] );
 
 enum
 {
@@ -42,22 +43,19 @@ enum
     PIXEL_8x4   = 4,
     PIXEL_4x8   = 5,
     PIXEL_4x4   = 6,
-    PIXEL_4x2   = 7,
-    PIXEL_2x4   = 8,
-    PIXEL_2x2   = 9,
+
+    /* Subsampled chroma only */
+    PIXEL_4x16  = 7,  /* 4:2:2 */
+    PIXEL_4x2   = 8,
+    PIXEL_2x8   = 9,  /* 4:2:2 */
+    PIXEL_2x4   = 10,
+    PIXEL_2x2   = 11,
 };
 
-static const struct
-{
-    int w;
-    int h;
-} x264_pixel_size[7] =
+static const struct { uint8_t w, h; } x264_pixel_size[12] =
 {
-    { 16, 16 },
-    { 16,  8 }, {  8, 16 },
-    {  8,  8 },
-    {  8,  4 }, {  4,  8 },
-    {  4,  4 }
+    { 16, 16 }, { 16, 8 }, { 8, 16 }, { 8, 8 }, { 8, 4 }, { 4, 8 }, { 4, 4 },
+    {  4, 16 }, {  4, 2 }, { 2,  8 }, { 2, 4 }, { 2, 2 },
 };
 
 static const uint8_t x264_size2pixel[5][5] =
@@ -69,30 +67,41 @@ static const uint8_t x264_size2pixel[5][5] =
     { 0, 0,        PIXEL_8x16, 0, PIXEL_16x16 }
 };
 
+static const uint8_t x264_luma2chroma_pixel[4][7] =
+{
+    { 0 },
+    { PIXEL_8x8,   PIXEL_8x4,  PIXEL_4x8,  PIXEL_4x4, PIXEL_4x2, PIXEL_2x4, PIXEL_2x2 }, /* 4:2:0 */
+    { PIXEL_8x16,  PIXEL_8x8,  PIXEL_4x16, PIXEL_4x8, PIXEL_4x4, PIXEL_2x8, PIXEL_2x4 }, /* 4:2:2 */
+    { PIXEL_16x16, PIXEL_16x8, PIXEL_8x16, PIXEL_8x8, PIXEL_8x4, PIXEL_4x8, PIXEL_4x4 }, /* 4:4:4 */
+};
+
 typedef struct
 {
-    x264_pixel_cmp_t  sad[7];
-    x264_pixel_cmp_t  ssd[7];
-    x264_pixel_cmp_t satd[7];
+    x264_pixel_cmp_t  sad[8];
+    x264_pixel_cmp_t  ssd[8];
+    x264_pixel_cmp_t satd[8];
     x264_pixel_cmp_t ssim[7];
     x264_pixel_cmp_t sa8d[4];
-    x264_pixel_cmp_t mbcmp[7]; /* either satd or sad for subpel refine and mode decision */
-    x264_pixel_cmp_t mbcmp_unaligned[7]; /* unaligned mbcmp for subpel */
-    x264_pixel_cmp_t fpelcmp[7]; /* either satd or sad for fullpel motion search */
+    x264_pixel_cmp_t mbcmp[8]; /* either satd or sad for subpel refine and mode decision */
+    x264_pixel_cmp_t mbcmp_unaligned[8]; /* unaligned mbcmp for subpel */
+    x264_pixel_cmp_t fpelcmp[8]; /* either satd or sad for fullpel motion search */
     x264_pixel_cmp_x3_t fpelcmp_x3[7];
     x264_pixel_cmp_x4_t fpelcmp_x4[7];
-    x264_pixel_cmp_t sad_aligned[7]; /* Aligned SAD for mbcmp */
-    int (*vsad)( pixel *, int );
-    int (*var2_8x8)( pixel *, int, pixel *, int, int * );
+    x264_pixel_cmp_t sad_aligned[8]; /* Aligned SAD for mbcmp */
+    int (*vsad)( pixel *, intptr_t, int );
+    int (*asd8)( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height );
+    uint64_t (*sa8d_satd[1])( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
 
-    uint64_t (*var[4])( pixel *pix, int stride );
-    uint64_t (*hadamard_ac[4])( pixel *pix, int stride );
+    uint64_t (*var[4])( pixel *pix, intptr_t stride );
+    int (*var2[4])( pixel *pix1, intptr_t stride1,
+                    pixel *pix2, intptr_t stride2, int *ssd );
+    uint64_t (*hadamard_ac[4])( pixel *pix, intptr_t stride );
 
-    void (*ssd_nv12_core)( pixel *pixuv1, int stride1,
-                           pixel *pixuv2, int stride2, int width, int height,
+    void (*ssd_nv12_core)( pixel *pixuv1, intptr_t stride1,
+                           pixel *pixuv2, intptr_t stride2, int width, int height,
                            uint64_t *ssd_u, uint64_t *ssd_v );
-    void (*ssim_4x4x2_core)( const pixel *pix1, int stride1,
-                             const pixel *pix2, int stride2, int sums[2][4] );
+    void (*ssim_4x4x2_core)( const pixel *pix1, intptr_t stride1,
+                             const pixel *pix2, intptr_t stride2, int sums[2][4] );
     float (*ssim_end4)( int sum0[5][4], int sum1[5][4], int width );
 
     /* multiple parallel calls to cmp. */
@@ -106,25 +115,42 @@ typedef struct
     int (*ads[7])( int enc_dc[4], uint16_t *sums, int delta,
                    uint16_t *cost_mvx, int16_t *mvs, int width, int thresh );
 
-    /* calculate satd or sad of V, H, and DC modes.
+    /* calculate satd or sad of V, H, and DC modes. */
+    void (*intra_mbcmp_x3_16x16)( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_satd_x3_16x16) ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_sad_x3_16x16)  ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_mbcmp_x3_4x4)  ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_satd_x3_4x4)   ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_sad_x3_4x4)    ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_mbcmp_x3_chroma)( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_satd_x3_chroma) ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_sad_x3_chroma)  ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_mbcmp_x3_8x16c) ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_satd_x3_8x16c)  ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_sad_x3_8x16c)   ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_mbcmp_x3_8x8c)  ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_satd_x3_8x8c)   ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_sad_x3_8x8c)    ( pixel *fenc, pixel *fdec, int res[3] );
+    void (*intra_mbcmp_x3_8x8)  ( pixel *fenc, pixel edge[36], int res[3] );
+    void (*intra_sa8d_x3_8x8)   ( pixel *fenc, pixel edge[36], int res[3] );
+    void (*intra_sad_x3_8x8)    ( pixel *fenc, pixel edge[36], int res[3] );
+    /* find minimum satd or sad of all modes, and set fdec.
      * may be NULL, in which case just use pred+satd instead. */
-    void (*intra_mbcmp_x3_16x16)( pixel *fenc, pixel *fdec  , int res[3] );
-    void (*intra_satd_x3_16x16) ( pixel *fenc, pixel *fdec  , int res[3] );
-    void (*intra_sad_x3_16x16)  ( pixel *fenc, pixel *fdec  , int res[3] );
-    void (*intra_mbcmp_x3_8x8c) ( pixel *fenc, pixel *fdec  , int res[3] );
-    void (*intra_satd_x3_8x8c)  ( pixel *fenc, pixel *fdec  , int res[3] );
-    void (*intra_sad_x3_8x8c)   ( pixel *fenc, pixel *fdec  , int res[3] );
-    void (*intra_mbcmp_x3_4x4)  ( pixel *fenc, pixel *fdec  , int res[3] );
-    void (*intra_satd_x3_4x4)   ( pixel *fenc, pixel *fdec  , int res[3] );
-    void (*intra_sad_x3_4x4)    ( pixel *fenc, pixel *fdec  , int res[3] );
-    void (*intra_mbcmp_x3_8x8)  ( pixel *fenc, pixel edge[33], int res[3] );
-    void (*intra_sa8d_x3_8x8)   ( pixel *fenc, pixel edge[33], int res[3] );
-    void (*intra_sad_x3_8x8)    ( pixel *fenc, pixel edge[33], int res[3] );
+    int (*intra_mbcmp_x9_4x4)( pixel *fenc, pixel *fdec, uint16_t *bitcosts );
+    int (*intra_satd_x9_4x4) ( pixel *fenc, pixel *fdec, uint16_t *bitcosts );
+    int (*intra_sad_x9_4x4)  ( pixel *fenc, pixel *fdec, uint16_t *bitcosts );
+    int (*intra_mbcmp_x9_8x8)( pixel *fenc, pixel *fdec, pixel edge[36], uint16_t *bitcosts, uint16_t *satds );
+    int (*intra_sa8d_x9_8x8) ( pixel *fenc, pixel *fdec, pixel edge[36], uint16_t *bitcosts, uint16_t *satds );
+    int (*intra_sad_x9_8x8)  ( pixel *fenc, pixel *fdec, pixel edge[36], uint16_t *bitcosts, uint16_t *satds );
 } x264_pixel_function_t;
 
 void x264_pixel_init( int cpu, x264_pixel_function_t *pixf );
-void x264_pixel_ssd_nv12( x264_pixel_function_t *pf, pixel *pix1, int i_pix1, pixel *pix2, int i_pix2, int i_width, int i_height, uint64_t *ssd_u, uint64_t *ssd_v );
-uint64_t x264_pixel_ssd_wxh( x264_pixel_function_t *pf, pixel *pix1, int i_pix1, pixel *pix2, int i_pix2, int i_width, int i_height );
-float x264_pixel_ssim_wxh( x264_pixel_function_t *pf, pixel *pix1, int i_pix1, pixel *pix2, int i_pix2, int i_width, int i_height, void *buf );
+void x264_pixel_ssd_nv12   ( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2,
+                             int i_width, int i_height, uint64_t *ssd_u, uint64_t *ssd_v );
+uint64_t x264_pixel_ssd_wxh( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2,
+                             int i_width, int i_height );
+float x264_pixel_ssim_wxh  ( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2,
+                             int i_width, int i_height, void *buf, int *cnt );
+int x264_field_vsad( x264_t *h, int mb_x, int mb_y );
 
 #endif