~ubuntu-branches/ubuntu/lucid/gavl/lucid

« back to all changes in this revision

Viewing changes to gavl/mmx/scale_mmx.c

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2008-11-07 13:47:46 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20081107134746-s4s970fo1bcde9zw
Tags: 1.0.1-1
* Adopted package for debian, with the blessing of previous maintainer.
* Based new package on Christian Marillat's package for debian-multimedia.
* Removed support for ccache until I figure out how to make it work
  with cdbs.
* Changed library package name since ABI is not backward compatible, but
  upstream did not bump major soversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************
2
 
 
3
 
  colorspace_mmx.c 
4
 
 
5
 
  Copyright (c) 2001-2002 by Burkhard Plaum - plaum@ipf.uni-stuttgart.de
6
 
 
7
 
  http://gmerlin.sourceforge.net
8
 
 
9
 
  This program is distributed in the hope that it will be useful,
10
 
  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
  GNU General Public License for more details.
13
 
 
14
 
  You should have received a copy of the GNU General Public License
15
 
  along with this program; if not, write to the Free Software
16
 
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
17
 
 
18
 
*****************************************************************/
19
 
 
20
 
#include <stdio.h>
21
 
#include <config.h>
22
 
#include <gavl.h>
23
 
#include <video.h>
24
 
#include <colorspace.h>
25
 
#include <attributes.h>
26
 
#include <scale.h>
27
 
 
28
 
#ifdef MMXEXT
29
 
#define MOVQ_R2M(reg,mem) movntq_r2m(reg, mem)
30
 
#else
31
 
#define MOVQ_R2M(reg,mem) movq_r2m(reg, mem)
32
 
#endif
33
 
 
34
 
#include "mmx.h"
35
 
#include "interpolate.h"
36
 
 
37
 
#define SCALE_FUNC_HEAD(a) \
38
 
  for(i = 0; i < s->table[plane].num_coeffs_h; i+=a)       \
39
 
    {
40
 
 
41
 
#define SCALE_FUNC_TAIL \
42
 
    }
43
 
 
44
 
#if 0
45
 
 
46
 
/* Bilinear in x direction */
47
 
 
48
 
#define LOAD_FACTORS_BILINEAR_X \
49
 
  tmp.uw[0] = (s->table[plane].coeffs_h[i].factor[0].fac_i >> 1);\
50
 
  tmp.uw[1] = tmp.uw[0];                                   \
51
 
  tmp.uw[2] = tmp.uw[0];                                   \
52
 
  tmp.uw[3] = tmp.uw[0];                                   \
53
 
  movq_m2r(tmp, mm4);
54
 
 
55
 
#define LOAD_FACTORS_BILINEAR_Y \
56
 
  tmp.uw[0] = (s->table[plane].coeffs_v[scanline].factor[0].fac_i >> 1);\
57
 
  tmp.uw[1] = tmp.uw[0];                                   \
58
 
  tmp.uw[2] = tmp.uw[0];                                   \
59
 
  tmp.uw[3] = tmp.uw[0];                                   \
60
 
  movq_m2r(tmp, mm4);
61
 
 
62
 
#ifdef SLOW_FUNCTIONS
63
 
 
64
 
static void scale_x_15_16_bilinear_mmx(gavl_video_scaler_t * s,
65
 
                                   uint8_t * _src,
66
 
                                   int src_stride,
67
 
                                   uint8_t * _dst,
68
 
                                   int plane,
69
 
                                   int scanline)
70
 
  {
71
 
  int i;
72
 
  uint16_t * src;
73
 
  uint16_t * dst;
74
 
  uint16_t * src_1;
75
 
  uint16_t * src_2;
76
 
 
77
 
  INTERPOLATE_INIT_TEMP
78
 
 
79
 
  src = (uint16_t*)(_src + scanline * src_stride);
80
 
  dst = (uint16_t*)_dst;
81
 
  
82
 
  SCALE_FUNC_HEAD(1)
83
 
    src_1 = src + s->table[plane].coeffs_h[i].index;
84
 
    src_2 = src_1 + 1;
85
 
 
86
 
    LOAD_FACTORS_BILINEAR_X
87
 
    INTERPOLATE_1D_LOAD_SRC_1_15
88
 
    INTERPOLATE_1D_LOAD_SRC_2_15
89
 
    INTERPOLATE_1D
90
 
    INTERPOLATE_WRITE_15
91
 
    
92
 
    dst++;
93
 
  SCALE_FUNC_TAIL
94
 
  emms();
95
 
  }
96
 
 
97
 
static void scale_x_16_16_bilinear_mmx(gavl_video_scaler_t * s,
98
 
                                   uint8_t * _src,
99
 
                                   int src_stride,
100
 
                                   uint8_t * _dst,
101
 
                                   int plane,
102
 
                                   int scanline)
103
 
  {
104
 
  int i;
105
 
  uint16_t * src;
106
 
  uint16_t * dst;
107
 
  uint16_t * src_1;
108
 
  uint16_t * src_2;
109
 
 
110
 
  INTERPOLATE_INIT_TEMP
111
 
 
112
 
  src = (uint16_t*)(_src + scanline * src_stride);
113
 
  dst = (uint16_t*)_dst;
114
 
  
115
 
  SCALE_FUNC_HEAD(1)
116
 
    src_1 = src + s->table[plane].coeffs_h[i].index;
117
 
    src_2 = src_1 + 1;
118
 
 
119
 
    LOAD_FACTORS_BILINEAR_X
120
 
    INTERPOLATE_1D_LOAD_SRC_1_16
121
 
    INTERPOLATE_1D_LOAD_SRC_2_16
122
 
    INTERPOLATE_1D
123
 
    INTERPOLATE_WRITE_16
124
 
    
125
 
    dst++;
126
 
  SCALE_FUNC_TAIL
127
 
  emms();
128
 
  }
129
 
 
130
 
static void scale_x_24_24_bilinear_mmx(gavl_video_scaler_t * s,
131
 
                                     uint8_t * _src,
132
 
                                     int src_stride,
133
 
                                     uint8_t * dst,
134
 
                                     int plane,
135
 
                                     int scanline)
136
 
  {
137
 
  int i;
138
 
  uint8_t * src;
139
 
  uint8_t * src_1;
140
 
  uint8_t * src_2;
141
 
 
142
 
  INTERPOLATE_INIT_TEMP
143
 
 
144
 
  src = _src + scanline * src_stride;
145
 
 
146
 
  SCALE_FUNC_HEAD(1)
147
 
    src_1 = src + 3 * s->table[plane].coeffs_h[i].index;
148
 
    src_2 = src_1 + 3;
149
 
 
150
 
    LOAD_FACTORS_BILINEAR_X
151
 
    INTERPOLATE_1D_LOAD_SRC_1_24
152
 
    INTERPOLATE_1D_LOAD_SRC_2_24
153
 
    INTERPOLATE_1D
154
 
    INTERPOLATE_WRITE_RGB24
155
 
 
156
 
    dst += 3;
157
 
  
158
 
  SCALE_FUNC_TAIL
159
 
  emms();
160
 
  }
161
 
#endif // SLOW_FUNCTIONS
162
 
 
163
 
static void scale_x_24_32_bilinear_mmx(gavl_video_scaler_t * s,
164
 
                                   uint8_t * _src,
165
 
                                   int src_stride,
166
 
                                   uint8_t * dst,
167
 
                                   int plane,
168
 
                                   int scanline)
169
 
  {
170
 
  int i;
171
 
  uint8_t * src;
172
 
  uint8_t * src_1;
173
 
  uint8_t * src_2;
174
 
 
175
 
  INTERPOLATE_INIT_TEMP
176
 
 
177
 
  src = _src + scanline * src_stride;
178
 
 
179
 
  SCALE_FUNC_HEAD(1)
180
 
    src_1 = src + 4 * s->table[plane].coeffs_h[i].index;
181
 
    src_2 = src_1 + 4;
182
 
 
183
 
    LOAD_FACTORS_BILINEAR_X
184
 
    INTERPOLATE_1D_LOAD_SRC_1_32
185
 
    INTERPOLATE_1D_LOAD_SRC_2_32
186
 
    INTERPOLATE_1D
187
 
    INTERPOLATE_WRITE_RGB32
188
 
 
189
 
    dst += 4;
190
 
  
191
 
  SCALE_FUNC_TAIL
192
 
  emms();
193
 
  }
194
 
 
195
 
static void scale_x_32_32_bilinear_mmx(gavl_video_scaler_t * s,
196
 
                                   uint8_t * _src,
197
 
                                   int src_stride,
198
 
                                   uint8_t * dst,
199
 
                                   int plane,
200
 
                                   int scanline)
201
 
  {
202
 
  int i;
203
 
  uint8_t * src;
204
 
  uint8_t * src_1;
205
 
  uint8_t * src_2;
206
 
 
207
 
  INTERPOLATE_INIT_TEMP
208
 
 
209
 
  src = _src + scanline * src_stride;
210
 
 
211
 
  SCALE_FUNC_HEAD(1)
212
 
    src_1 = src + 4 * s->table[plane].coeffs_h[i].index;
213
 
    src_2 = src_1 + 4;
214
 
 
215
 
    LOAD_FACTORS_BILINEAR_X
216
 
    INTERPOLATE_1D_LOAD_SRC_1_32
217
 
    INTERPOLATE_1D_LOAD_SRC_2_32
218
 
    INTERPOLATE_1D
219
 
    INTERPOLATE_WRITE_RGBA32
220
 
 
221
 
    dst += 4;
222
 
  
223
 
  SCALE_FUNC_TAIL
224
 
  emms();
225
 
  }
226
 
 
227
 
#ifdef SLOW_FUNCTIONS
228
 
 
229
 
static void scale_x_8_bilinear_mmx(gavl_video_scaler_t * s,
230
 
                               uint8_t * _src,
231
 
                               int src_stride,
232
 
                               uint8_t * dst,
233
 
                               int plane,
234
 
                               int scanline)
235
 
  {
236
 
  int i;
237
 
  uint8_t * src;
238
 
  INTERPOLATE_INIT_TEMP
239
 
  src = _src + scanline * src_stride;
240
 
 
241
 
  SCALE_FUNC_HEAD(4)
242
 
    tmp.uw[0] = *(src + s->table[plane].coeffs_h[i].index);
243
 
    tmp.uw[1] = *(src + s->table[plane].coeffs_h[i+1].index);
244
 
    tmp.uw[2] = *(src + s->table[plane].coeffs_h[i+2].index);
245
 
    tmp.uw[3] = *(src + s->table[plane].coeffs_h[i+3].index);
246
 
    movq_m2r(tmp, mm0);
247
 
 
248
 
    tmp.uw[0] = *(src + s->table[plane].coeffs_h[i].index+1);
249
 
    tmp.uw[1] = *(src + s->table[plane].coeffs_h[i+1].index+1);
250
 
    tmp.uw[2] = *(src + s->table[plane].coeffs_h[i+2].index+1);
251
 
    tmp.uw[3] = *(src + s->table[plane].coeffs_h[i+3].index+1);
252
 
    movq_m2r(tmp, mm1);
253
 
 
254
 
    tmp.uw[0] = *(src + s->table[plane].coeffs_h[i].factor[0]);
255
 
    tmp.uw[1] = *(src + s->table[plane].coeffs_h[i+1].factor[0]);
256
 
    tmp.uw[2] = *(src + s->table[plane].coeffs_h[i+2].factor[0]);
257
 
    tmp.uw[3] = *(src + s->table[plane].coeffs_h[i+3].factor[0]);
258
 
    movq_m2r(tmp, mm4);
259
 
    psrlw_i2r(1, mm4);
260
 
    INTERPOLATE_1D
261
 
    INTERPOLATE_WRITE_RGBA32    
262
 
    
263
 
    dst+=4;
264
 
  SCALE_FUNC_TAIL
265
 
  emms();
266
 
  }
267
 
 
268
 
 
269
 
static void scale_x_8_bilinear_advance(gavl_video_scaler_t * s,
270
 
                                       uint8_t * _src,
271
 
                                       int src_stride,
272
 
                                       uint8_t * dst,
273
 
                                       int plane,
274
 
                                       int scanline,
275
 
                                       int advance)
276
 
  {
277
 
  int i;
278
 
  uint8_t * src;
279
 
  INTERPOLATE_INIT_TEMP
280
 
  src = _src + scanline * src_stride;
281
 
 
282
 
  SCALE_FUNC_HEAD(4)
283
 
    tmp.uw[0] = *(src + advance * s->table[plane].coeffs_h[i].index);
284
 
    tmp.uw[1] = *(src + advance * s->table[plane].coeffs_h[i+1].index);
285
 
    tmp.uw[2] = *(src + advance * s->table[plane].coeffs_h[i+2].index);
286
 
    tmp.uw[3] = *(src + advance * s->table[plane].coeffs_h[i+3].index);
287
 
    movq_m2r(tmp, mm0);
288
 
 
289
 
    tmp.uw[0] = *(src + advance * (s->table[plane].coeffs_h[i].index + 1));
290
 
    tmp.uw[1] = *(src + advance * (s->table[plane].coeffs_h[i+1].index + 1));
291
 
    tmp.uw[2] = *(src + advance * (s->table[plane].coeffs_h[i+2].index + 1));
292
 
    tmp.uw[3] = *(src + advance * (s->table[plane].coeffs_h[i+3].index + 1));
293
 
    movq_m2r(tmp, mm1);
294
 
 
295
 
    tmp.uw[0] = s->table[plane].coeffs_h[i].factor[0];
296
 
    tmp.uw[1] = s->table[plane].coeffs_h[i+1].factor[0];
297
 
    tmp.uw[2] = s->table[plane].coeffs_h[i+2].factor[0];
298
 
    tmp.uw[3] = s->table[plane].coeffs_h[i+3].factor[0];
299
 
    movq_m2r(tmp, mm4);
300
 
    psrlw_i2r(1, mm4);
301
 
    INTERPOLATE_1D
302
 
    MOVQ_R2M(mm7, tmp);
303
 
    dst[0] = tmp.ub[0];
304
 
    dst[advance] = tmp.ub[2];
305
 
    dst[2*advance] = tmp.ub[4];
306
 
    dst[3*advance] = tmp.ub[6];
307
 
    
308
 
    dst+=4 * advance;
309
 
  SCALE_FUNC_TAIL
310
 
  }
311
 
 
312
 
 
313
 
static void scale_x_yuy2_bilinear_mmx(gavl_video_scaler_t * s,
314
 
                                  uint8_t * src,
315
 
                                  int src_stride,
316
 
                                  uint8_t * dst,
317
 
                                  int plane,
318
 
                                  int scanline)
319
 
  {
320
 
  scale_x_8_bilinear_advance(s,
321
 
                             src,
322
 
                             src_stride,
323
 
                             dst,
324
 
                             0,
325
 
                             scanline, 2);
326
 
  
327
 
  scale_x_8_bilinear_advance(s,
328
 
                             src+1,
329
 
                             src_stride,
330
 
                             dst+1,
331
 
                             1,
332
 
                             scanline, 4);
333
 
  
334
 
  scale_x_8_bilinear_advance(s,
335
 
                             src+3,
336
 
                             src_stride,
337
 
                             dst+3,
338
 
                             1,
339
 
                             scanline, 4);
340
 
  emms();
341
 
  }
342
 
 
343
 
static void scale_x_uyvy_bilinear_mmx(gavl_video_scaler_t * s,
344
 
                                  uint8_t * src,
345
 
                                  int src_stride,
346
 
                                  uint8_t * dst,
347
 
                                  int plane,
348
 
                                  int scanline)
349
 
  {
350
 
  scale_x_8_bilinear_advance(s,
351
 
                             src+1,
352
 
                             src_stride,
353
 
                             dst+1,
354
 
                             0,
355
 
                             scanline, 2);
356
 
 
357
 
  scale_x_8_bilinear_advance(s,
358
 
                             src,
359
 
                             src_stride,
360
 
                             dst,
361
 
                             1,
362
 
                             scanline, 4);
363
 
 
364
 
  scale_x_8_bilinear_advance(s,
365
 
                             src+2,
366
 
                             src_stride,
367
 
                             dst+2,
368
 
                             1,
369
 
                             scanline, 4);
370
 
 
371
 
  emms();
372
 
  }
373
 
 
374
 
 
375
 
 
376
 
/* Bilinear y */
377
 
 
378
 
static void scale_y_15_16_bilinear_mmx(gavl_video_scaler_t * s,
379
 
                                     uint8_t * src,
380
 
                                     int src_stride,
381
 
                                     uint8_t * _dst,
382
 
                                     int plane,
383
 
                                     int scanline)
384
 
  {
385
 
  int i;
386
 
  uint16_t * dst;
387
 
  uint16_t * src_1;
388
 
  uint16_t * src_2;
389
 
  uint16_t * src_start_1;
390
 
  uint16_t * src_start_2;
391
 
 
392
 
  INTERPOLATE_INIT_TEMP
393
 
    
394
 
  src_start_1 = (uint16_t*)(src + s->table[plane].coeffs_v[scanline].index * src_stride);
395
 
  src_start_2 = (uint16_t*)((uint8_t*)src_start_1 + src_stride);
396
 
  dst = (uint16_t*)_dst;
397
 
 
398
 
  LOAD_FACTORS_BILINEAR_Y
399
 
  
400
 
  SCALE_FUNC_HEAD(1)
401
 
    src_1 = src_start_1 + i;
402
 
    src_2 = src_start_2 + i;
403
 
 
404
 
    INTERPOLATE_1D_LOAD_SRC_1_15
405
 
    INTERPOLATE_1D_LOAD_SRC_2_15
406
 
    INTERPOLATE_1D
407
 
    INTERPOLATE_WRITE_15
408
 
    
409
 
    dst++;
410
 
  SCALE_FUNC_TAIL
411
 
  emms();
412
 
  }
413
 
 
414
 
static void scale_y_16_16_bilinear_mmx(gavl_video_scaler_t * s,
415
 
                                   uint8_t * src,
416
 
                                   int src_stride,
417
 
                                   uint8_t * _dst,
418
 
                                   int plane,
419
 
                                   int scanline)
420
 
  {
421
 
  int i;
422
 
  uint16_t * dst;
423
 
  uint16_t * src_1;
424
 
  uint16_t * src_2;
425
 
  uint16_t * src_start_1;
426
 
  uint16_t * src_start_2;
427
 
 
428
 
  INTERPOLATE_INIT_TEMP
429
 
  src_start_1 = (uint16_t*)(src + s->table[plane].coeffs_v[scanline].index * src_stride);
430
 
  src_start_2 = (uint16_t*)((uint8_t*)src_start_1 + src_stride);
431
 
 
432
 
  dst = (uint16_t*)_dst;
433
 
 
434
 
  LOAD_FACTORS_BILINEAR_Y
435
 
  
436
 
  SCALE_FUNC_HEAD(1)
437
 
    src_1 = src_start_1 + i;
438
 
    src_2 = src_start_2 + i;
439
 
 
440
 
    INTERPOLATE_1D_LOAD_SRC_1_16
441
 
    INTERPOLATE_1D_LOAD_SRC_2_16
442
 
    INTERPOLATE_1D
443
 
    INTERPOLATE_WRITE_16
444
 
    
445
 
    dst++;
446
 
  SCALE_FUNC_TAIL
447
 
  emms();
448
 
  }
449
 
 
450
 
static void scale_y_24_24_bilinear_mmx(gavl_video_scaler_t * s,
451
 
                                   uint8_t * src,
452
 
                                   int src_stride,
453
 
                                   uint8_t * dst,
454
 
                                   int plane,
455
 
                                   int scanline)
456
 
  {
457
 
  int i;
458
 
  uint8_t * src_start_1;
459
 
  uint8_t * src_start_2;
460
 
  uint8_t * src_1;
461
 
  uint8_t * src_2;
462
 
 
463
 
  INTERPOLATE_INIT_TEMP
464
 
 
465
 
  src_start_1 = src + s->table[plane].coeffs_v[scanline].index * src_stride;
466
 
  src_start_2 = src_start_1 + src_stride;
467
 
 
468
 
  LOAD_FACTORS_BILINEAR_Y
469
 
  
470
 
  SCALE_FUNC_HEAD(1)
471
 
    src_1 = src_start_1 + 3 * i;
472
 
    src_2 = src_start_2 + 3 * i;
473
 
 
474
 
    INTERPOLATE_1D_LOAD_SRC_1_24
475
 
    INTERPOLATE_1D_LOAD_SRC_2_24
476
 
    INTERPOLATE_1D
477
 
    INTERPOLATE_WRITE_RGB24
478
 
    
479
 
    dst += 3;
480
 
  SCALE_FUNC_TAIL
481
 
  emms();
482
 
  }
483
 
#endif // SLOW_FUNCTIONS
484
 
 
485
 
static void scale_y_24_32_bilinear_mmx(gavl_video_scaler_t * s,
486
 
                                   uint8_t * src,
487
 
                                   int src_stride,
488
 
                                   uint8_t * dst,
489
 
                                   int plane,
490
 
                                   int scanline)
491
 
  {
492
 
  int i;
493
 
  uint8_t * src_start_1;
494
 
  uint8_t * src_start_2;
495
 
  uint8_t * src_1;
496
 
  uint8_t * src_2;
497
 
 
498
 
  INTERPOLATE_INIT_TEMP
499
 
 
500
 
  src_start_1 = src + s->table[plane].coeffs_v[scanline].index * src_stride;
501
 
  src_start_2 = src_start_1 + src_stride;
502
 
 
503
 
  LOAD_FACTORS_BILINEAR_Y
504
 
  
505
 
  SCALE_FUNC_HEAD(1)
506
 
    src_1 = src_start_1 + 4 * i;
507
 
    src_2 = src_start_2 + 4 * i;
508
 
 
509
 
    INTERPOLATE_1D_LOAD_SRC_1_32
510
 
    INTERPOLATE_1D_LOAD_SRC_2_32
511
 
    INTERPOLATE_1D
512
 
    INTERPOLATE_WRITE_RGB32
513
 
 
514
 
    dst += 4;
515
 
  SCALE_FUNC_TAIL
516
 
  emms();
517
 
  }
518
 
 
519
 
static void scale_y_32_32_bilinear_mmx(gavl_video_scaler_t * s,
520
 
                                   uint8_t * src,
521
 
                                   int src_stride,
522
 
                                   uint8_t * dst,
523
 
                                   int plane,
524
 
                                   int scanline)
525
 
  {
526
 
  int i;
527
 
  uint8_t * src_start_1;
528
 
  uint8_t * src_start_2;
529
 
  uint8_t * src_1;
530
 
  uint8_t * src_2;
531
 
  
532
 
  INTERPOLATE_INIT_TEMP
533
 
 
534
 
  src_start_1 = src + s->table[plane].coeffs_v[scanline].index * src_stride;
535
 
  src_start_2 = src_start_1 + src_stride;
536
 
 
537
 
  LOAD_FACTORS_BILINEAR_Y
538
 
  
539
 
  SCALE_FUNC_HEAD(1)
540
 
    src_1 = src_start_1 + 4 * i;
541
 
    src_2 = src_start_2 + 4 * i;
542
 
 
543
 
    INTERPOLATE_1D_LOAD_SRC_1_32
544
 
    INTERPOLATE_1D_LOAD_SRC_2_32
545
 
    INTERPOLATE_1D
546
 
    INTERPOLATE_WRITE_RGBA32
547
 
    
548
 
    dst += 4;
549
 
  SCALE_FUNC_TAIL
550
 
  emms();
551
 
  }
552
 
 
553
 
static void scale_y_8_bilinear_mmx(gavl_video_scaler_t * s,
554
 
                               uint8_t * src,
555
 
                               int src_stride,
556
 
                               uint8_t * dst,
557
 
                               int plane,
558
 
                               int scanline)
559
 
  {
560
 
  int i;
561
 
  uint8_t * src_1;
562
 
  uint8_t * src_2;
563
 
 
564
 
  INTERPOLATE_INIT_TEMP
565
 
 
566
 
  src_1 = src + s->table[plane].coeffs_v[scanline].index * src_stride;
567
 
  src_2 = src_1 + src_stride;
568
 
 
569
 
  tmp.uw[0] = (s->table[plane].coeffs_v[scanline].factor[0].fac_i >> 1);
570
 
  tmp.uw[1] = tmp.uw[0];
571
 
  tmp.uw[2] = tmp.uw[0];
572
 
  tmp.uw[3] = tmp.uw[0];
573
 
  movq_m2r(tmp, mm4);
574
 
  
575
 
  SCALE_FUNC_HEAD(4)
576
 
    
577
 
    
578
 
    INTERPOLATE_1D_LOAD_SRC_1_32
579
 
    INTERPOLATE_1D_LOAD_SRC_2_32
580
 
    INTERPOLATE_1D
581
 
    INTERPOLATE_WRITE_RGBA32
582
 
    
583
 
    src_1+=4;
584
 
    src_2+=4;
585
 
 
586
 
    dst+=4;
587
 
  SCALE_FUNC_TAIL
588
 
  emms();
589
 
  }
590
 
 
591
 
static void scale_y_yuv_packed_bilinear_mmx(gavl_video_scaler_t * s,
592
 
                                  uint8_t * src,
593
 
                                  int src_stride,
594
 
                                  uint8_t * dst,
595
 
                                  int plane,
596
 
                                  int scanline)
597
 
  {
598
 
  int i;
599
 
  uint8_t * src_1;
600
 
  uint8_t * src_2;
601
 
 
602
 
  INTERPOLATE_INIT_TEMP
603
 
 
604
 
  src_1 = src + s->table[plane].coeffs_v[scanline].index * src_stride;
605
 
  src_2 = src_1 + src_stride;
606
 
 
607
 
  tmp.uw[0] = (s->table[plane].coeffs_v[scanline].factor[0].fac_i >> 1);
608
 
  tmp.uw[1] = tmp.uw[0];
609
 
  tmp.uw[2] = tmp.uw[0];
610
 
  tmp.uw[3] = tmp.uw[0];
611
 
  
612
 
  movq_m2r(tmp, mm4);
613
 
    
614
 
  SCALE_FUNC_HEAD(2)
615
 
    
616
 
    
617
 
    INTERPOLATE_1D_LOAD_SRC_1_32
618
 
    INTERPOLATE_1D_LOAD_SRC_2_32
619
 
    INTERPOLATE_1D
620
 
    INTERPOLATE_WRITE_RGBA32
621
 
    
622
 
    src_1+=4;
623
 
    src_2+=4;
624
 
 
625
 
    dst+=4;
626
 
  SCALE_FUNC_TAIL
627
 
  emms();
628
 
  }
629
 
 
630
 
#endif
631
 
 
632
 
#ifdef MMXEXT
633
 
void gavl_init_scale_funcs_mmxext(gavl_scale_funcs_t * tab,
634
 
                                  gavl_scale_mode_t scale_mode,
635
 
                                  int scale_x, int scale_y, int min_scanline_width)
636
 
#else
637
 
void gavl_init_scale_funcs_mmx(gavl_scale_funcs_t * tab,
638
 
                               gavl_scale_mode_t scale_mode,
639
 
                               int scale_x, int scale_y, int min_scanline_width)
640
 
  
641
 
#endif
642
 
  {
643
 
#if 0
644
 
  
645
 
  //  fprintf(stderr, "gavl_init_scale_funcs_mmx %d %d\n", scale_x, scale_y);
646
 
  switch(scale_mode)
647
 
    {
648
 
    case GAVL_SCALE_AUTO:
649
 
    case GAVL_SCALE_NEAREST:
650
 
      break;
651
 
    case GAVL_SCALE_BILINEAR:
652
 
      if(scale_x && scale_y)
653
 
        {
654
 
#if 0
655
 
        tab->scale_15_16 = scale_xy_15_16_bilinear_mmx;
656
 
        tab->scale_16_16 = scale_xy_16_16_bilinear_mmx;
657
 
        tab->scale_24_24 = scale_xy_24_24_bilinear_mmx;
658
 
        tab->scale_24_32 = scale_xy_24_32_bilinear_mmx;
659
 
        tab->scale_32_32 = scale_xy_32_32_bilinear_mmx;
660
 
        
661
 
        tab->scale_8     = scale_xy_8_bilinear_mmx;
662
 
        tab->scale_yuy2  = scale_xy_yuy2_bilinear_mmx;
663
 
        tab->scale_uyvy  = scale_xy_uyvy_bilinear_mmx;
664
 
#endif
665
 
        }
666
 
      else if(scale_x)
667
 
        {
668
 
#ifdef SLOW_FUNCTIONS
669
 
        tab->scale_15_16 = scale_x_15_16_bilinear_mmx;
670
 
        tab->scale_16_16 = scale_x_16_16_bilinear_mmx;
671
 
        tab->scale_24_24 = scale_x_24_24_bilinear_mmx;
672
 
        tab->scale_yuy2  = scale_x_yuy2_bilinear_mmx;
673
 
        tab->scale_uyvy  = scale_x_uyvy_bilinear_mmx;
674
 
        if(!(min_scanline_width % 4))
675
 
          {
676
 
          tab->scale_8     = scale_x_8_bilinear_mmx;
677
 
          }
678
 
#endif
679
 
        tab->scale_32_32 = scale_x_32_32_bilinear_mmx;
680
 
        tab->scale_24_32 = scale_x_24_32_bilinear_mmx;
681
 
        }
682
 
      else if(scale_y)
683
 
        {
684
 
#ifdef SLOW_FUNCTIONS
685
 
        tab->scale_15_16 = scale_y_15_16_bilinear_mmx;
686
 
        tab->scale_16_16 = scale_y_16_16_bilinear_mmx;
687
 
        tab->scale_24_24 = scale_y_24_24_bilinear_mmx;
688
 
#endif
689
 
        tab->scale_24_32 = scale_y_24_32_bilinear_mmx;
690
 
        tab->scale_32_32 = scale_y_32_32_bilinear_mmx;
691
 
        if(!(min_scanline_width % 4))
692
 
          {
693
 
          tab->scale_8     = scale_y_8_bilinear_mmx;
694
 
          }
695
 
 
696
 
        tab->scale_yuy2  = scale_y_yuv_packed_bilinear_mmx;
697
 
        tab->scale_uyvy  = scale_y_yuv_packed_bilinear_mmx;
698
 
        }
699
 
      break;
700
 
    case GAVL_SCALE_NONE:
701
 
      break;
702
 
    }
703
 
#endif
704
 
  }
705