source: soft/giet_vm/applications/rosenfeld/nrc2/src/nrmem2xx.c @ 826

Last change on this file since 826 was 826, checked in by meunier, 7 years ago
  • Mise à jour NR2 et Rosenfeld
File size: 5.5 KB
Line 
1/* ------------------ */
2/* --- nrmem2XX.c --- */
3/* ------------------ */
4
5/*
6 * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved
7 * Univ Paris Sud XI, CNRS
8 */
9
10#include "def.h"
11#include "nrmem1.h"
12#include "nrmem2.h"
13#include "nrmem2X.h"
14#include "nrmem2XX.h"
15
16/* ---------------------------- */
17/* --- Left & right Rotate  --- */
18/* ---------------------------- */
19// (i,j) -> (n-j,i) -> (n-i,n-j) -> (j,n-i) ->
20
21
22#undef rotate_type_matrix
23#define rotate_type_matrix(t) \
24void short_name(t,lrotate_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D) \
25{                                              \
26        int32_t n = nrl + nrh;                     \
27        for (int32_t i = nrl; i <= nrh; i++) {     \
28                for (int32_t j = ncl; j <= nch; j++) { \
29                        D[n - j][i] = S[i][j];             \
30                }                                      \
31        }                                          \
32}                                              \
33void short_name(t,rrotate_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D) \
34{                                              \
35        int32_t n = nrl + nrh;                     \
36        for (int32_t i = nrl; i <= nrh; i++) {     \
37                for (int32_t j = ncl; j <= nch; j++) { \
38                        D[i][j] = S[n - j][i];             \
39                }                                      \
40        }                                          \
41}                                              \
42void short_name(t,lrotate1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \
43        int32_t n = nrl + nrh;                     \
44        t temp;                                    \
45        for (int32_t i = nrl; i <= nrh; i++) {     \
46                for (int32_t j = ncl; j <= nch; j++) { \
47                        temp = S[n - j][i];                \
48                        S[n - j][i] = S[i][j];             \
49                        S[i][j] = temp;                    \
50                }                                      \
51        }                                          \
52}                                              \
53void short_name(t,rrotate1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \
54{                                              \
55        int32_t n = nrl + nrh;                     \
56        t temp;                                    \
57        for (int32_t i = nrl; i <= nrh; i++) {     \
58                for (int32_t j = ncl; j <= nch; j++) { \
59                        temp = S[i][j];                    \
60                        S[i][j] = S[n - j][i];             \
61                        S[n - j][i] = temp;                \
62                }                                      \
63        }                                          \
64}
65
66rotate_type_matrix(int8_t);
67rotate_type_matrix(uint8_t);
68rotate_type_matrix(int16_t);
69rotate_type_matrix(uint16_t);
70rotate_type_matrix(int32_t);
71rotate_type_matrix(uint32_t);
72rotate_type_matrix(int64_t);
73rotate_type_matrix(uint64_t);
74rotate_type_matrix(float);
75rotate_type_matrix(double);
76rotate_type_matrix(rgb8);
77rotate_type_matrix(rgbx8);
78
79
80
81/* ---------------------------------- */
82/* --- Horizontal & Vertical Flip --- */
83/* ---------------------------------- */
84
85
86#undef flip_type_matrix
87#define flip_type_matrix(t) \
88void short_name(t,hflip_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D) \
89{                                              \
90        int32_t n = ncl + nch;                     \
91        for (int32_t i = nrl; i <= nrh; i++) {     \
92                for (int32_t j = ncl; j <= nch; j++) { \
93                        D[i][n - j] = S[i][j];             \
94                }                                      \
95        }                                          \
96}                                              \
97void short_name(t,vflip_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D) \
98{                                              \
99        int32_t n = nrl + nrh;                     \
100        for (int32_t i = nrl; i <= nrh; i++) {     \
101                for (int32_t j = ncl; j <= nch; j++) { \
102                        D[n - i][j] = S[i][j];             \
103                }                                      \
104        }                                          \
105}                                              \
106void short_name(t,hflip1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \
107{                                              \
108        int32_t n = ncl + nch;                     \
109        t temp;                                    \
110        for (int32_t i = nrl; i <= nrh; i++) {     \
111                for (int32_t j = ncl; j <= nch; j++) { \
112                        temp = S[i][n - j];                \
113                        S[i][n - j] = S[i][j];             \
114                        S[i][j] = temp;                    \
115                }                                      \
116        }                                          \
117}                                              \
118void short_name(t,vflip1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \
119{                                              \
120        int32_t n = ncl + nch;                     \
121        t temp;                                    \
122        for (int32_t i = nrl; i <= nrh; i++) {     \
123                for (int32_t j = ncl; j <= nch; j++) { \
124                        temp = S[n - i][j];                \
125                        S[n - i][j] = S[i][j];             \
126                        S[i][j] = temp;                    \
127                }                                      \
128        }                                          \
129}
130
131flip_type_matrix(int8_t);
132flip_type_matrix(uint8_t);
133flip_type_matrix(int16_t);
134flip_type_matrix(uint16_t);
135flip_type_matrix(int32_t);
136flip_type_matrix(uint32_t);
137flip_type_matrix(int64_t);
138flip_type_matrix(uint64_t);
139flip_type_matrix(float);
140flip_type_matrix(double);
141flip_type_matrix(rgb8);
142flip_type_matrix(rgbx8);
143
144
145
146// Local Variables:
147// tab-width: 4
148// c-basic-offset: 4
149// c-file-offsets:((innamespace . 0)(inline-open . 0))
150// indent-tabs-mode: nil
151// End:
152
153// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
154
Note: See TracBrowser for help on using the repository browser.