Revision e3e98d3c libavcodec/alpha/dsputil_alpha.c

View differences:

libavcodec/alpha/dsputil_alpha.c
151 151
}
152 152
#endif
153 153

  
154
#define OP(LOAD, STORE, INCR)			\
155
    do {					\
156
	STORE(LOAD(pixels), block);		\
157
	pixels += line_size;			\
158
	block += INCR;				\
154
#define OP(LOAD, STORE)                         \
155
    do {                                        \
156
        STORE(LOAD(pixels), block);             \
157
        pixels += line_size;                    \
158
        block += line_size;                     \
159 159
    } while (--h)
160 160

  
161
#define OP_X2(LOAD, STORE, INCR)				\
162
    do {							\
163
	uint64_t pix1, pix2;					\
164
								\
165
	pix1 = LOAD(pixels);					\
166
	pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56);	\
167
	STORE(AVG2(pix1, pix2), block);				\
168
	pixels += line_size;					\
169
	block += INCR;						\
161
#define OP_X2(LOAD, STORE)                                      \
162
    do {                                                        \
163
        uint64_t pix1, pix2;                                    \
164
                                                                \
165
        pix1 = LOAD(pixels);                                    \
166
        pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56);        \
167
        STORE(AVG2(pix1, pix2), block);                         \
168
        pixels += line_size;                                    \
169
        block += line_size;                                     \
170 170
    } while (--h)
171 171

  
172
#define OP_Y2(LOAD, STORE, INCR)		\
173
    do {					\
174
	uint64_t pix = LOAD(pixels);		\
175
	do {					\
176
	    uint64_t next_pix;			\
177
						\
178
	    pixels += line_size;		\
179
	    next_pix = LOAD(pixels);		\
180
	    STORE(AVG2(pix, next_pix), block);	\
181
	    block += INCR;			\
182
	    pix = next_pix;			\
183
	} while (--h);				\
172
#define OP_Y2(LOAD, STORE)                      \
173
    do {                                        \
174
        uint64_t pix = LOAD(pixels);            \
175
        do {                                    \
176
            uint64_t next_pix;                  \
177
                                                \
178
            pixels += line_size;                \
179
            next_pix = LOAD(pixels);            \
180
            STORE(AVG2(pix, next_pix), block);  \
181
            block += line_size;                 \
182
            pix = next_pix;                     \
183
        } while (--h);                          \
184 184
    } while (0)
185 185

  
186
#define OP_XY2(LOAD, STORE, INCR)                                           \
186
#define OP_XY2(LOAD, STORE)                                                 \
187 187
    do {                                                                    \
188 188
        uint64_t pix1 = LOAD(pixels);                                       \
189 189
        uint64_t pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56);           \
......
208 208
                + pix_h + npix_h;                                           \
209 209
            STORE(avg, block);                                              \
210 210
                                                                            \
211
            block += INCR;                                                  \
211
            block += line_size;                                             \
212 212
            pix_l = npix_l;                                                 \
213 213
            pix_h = npix_h;                                                 \
214 214
        } while (--h);                                                      \
215 215
    } while (0)
216 216

  
217
#define MAKE_OP(BTYPE, OPNAME, SUFF, OPKIND, STORE, INCR)       \
218
static void OPNAME ## _pixels ## SUFF ## _axp                   \
219
        (BTYPE *restrict block, const uint8_t *restrict pixels, \
220
         int line_size, int h)                                  \
221
{                                                               \
222
    if ((size_t) pixels & 0x7) {                                \
223
        OPKIND(uldq, STORE, INCR);                              \
224
    } else {                                                    \
225
        OPKIND(ldq, STORE, INCR);                               \
226
    }                                                           \
217
#define MAKE_OP(OPNAME, SUFF, OPKIND, STORE)                            \
218
static void OPNAME ## _pixels ## SUFF ## _axp                           \
219
        (uint8_t *restrict block, const uint8_t *restrict pixels,       \
220
         int line_size, int h)                                          \
221
{                                                                       \
222
    if ((size_t) pixels & 0x7) {                                        \
223
        OPKIND(uldq, STORE);                                            \
224
    } else {                                                            \
225
        OPKIND(ldq, STORE);                                             \
226
    }                                                                   \
227 227
}
228 228

  
229
#define PIXOP(BTYPE, OPNAME, STORE, INCR)		\
230
    MAKE_OP(BTYPE, OPNAME, ,	 OP,	 STORE, INCR);	\
231
    MAKE_OP(BTYPE, OPNAME, _x2,	 OP_X2,	 STORE, INCR);	\
232
    MAKE_OP(BTYPE, OPNAME, _y2,	 OP_Y2,	 STORE, INCR);	\
233
    MAKE_OP(BTYPE, OPNAME, _xy2, OP_XY2, STORE, INCR);
229
#define PIXOP(OPNAME, STORE)                    \
230
    MAKE_OP(OPNAME, ,     OP,     STORE)        \
231
    MAKE_OP(OPNAME, _x2,  OP_X2,  STORE)        \
232
    MAKE_OP(OPNAME, _y2,  OP_Y2,  STORE)        \
233
    MAKE_OP(OPNAME, _xy2, OP_XY2, STORE)
234 234

  
235 235
/* Rounding primitives.  */
236 236
#define AVG2 avg2
237 237
#define AVG4 avg4
238 238
#define AVG4_ROUNDER BYTE_VEC(0x02)
239 239
#define STORE(l, b) stq(l, b)
240
PIXOP(uint8_t, put, STORE, line_size);
240
PIXOP(put, STORE);
241 241

  
242 242
#undef STORE
243 243
#define STORE(l, b) stq(AVG2(l, ldq(b)), b);
244
PIXOP(uint8_t, avg, STORE, line_size);
244
PIXOP(avg, STORE);
245 245

  
246 246
/* Not rounding primitives.  */
247 247
#undef AVG2
......
252 252
#define AVG4 avg4_no_rnd
253 253
#define AVG4_ROUNDER BYTE_VEC(0x01)
254 254
#define STORE(l, b) stq(l, b)
255
PIXOP(uint8_t, put_no_rnd, STORE, line_size);
255
PIXOP(put_no_rnd, STORE);
256 256

  
257 257
#undef STORE
258 258
#define STORE(l, b) stq(AVG2(l, ldq(b)), b);
259
PIXOP(uint8_t, avg_no_rnd, STORE, line_size);
259
PIXOP(avg_no_rnd, STORE);
260 260

  
261 261
void dsputil_init_alpha(void)
262 262
{

Also available in: Unified diff