Revision d8dad2a5 postproc/rgb2rgb_template.c

View differences:

postproc/rgb2rgb_template.c
63 63
  const uint8_t *s = src;
64 64
  const uint8_t *end;
65 65
#ifdef HAVE_MMX
66
  uint8_t *mm_end;
66
  const uint8_t *mm_end;
67 67
#endif
68 68
  end = s + src_size;
69 69
#ifdef HAVE_MMX
70 70
  __asm __volatile(PREFETCH"	%0"::"m"(*s):"memory");
71
  mm_end = end - 23;
71 72
  __asm __volatile("movq	%0, %%mm7"::"m"(mask32):"memory");
72
  mm_end = (uint8_t*)((((unsigned long)end)/24)*24);
73 73
  while(s < mm_end)
74 74
  {
75 75
    __asm __volatile(
......
114 114
  const uint8_t *s = src;
115 115
  const uint8_t *end;
116 116
#ifdef HAVE_MMX
117
  uint8_t *mm_end;
117
  const uint8_t *mm_end;
118 118
#endif
119 119
  end = s + src_size;
120 120
#ifdef HAVE_MMX
121 121
  __asm __volatile(PREFETCH"	%0"::"m"(*s):"memory");
122
  mm_end = (uint8_t*)((((unsigned long)end)/32)*32);
122
  mm_end = end - 31;
123 123
  while(s < mm_end)
124 124
  {
125 125
    __asm __volatile(
......
196 196
  register const uint8_t* s=src;
197 197
  register uint8_t* d=dst;
198 198
  register const uint8_t *end;
199
  uint8_t *mm_end;
199
  const uint8_t *mm_end;
200 200
  end = s + src_size;
201 201
#ifdef HAVE_MMX
202 202
  __asm __volatile(PREFETCH"	%0"::"m"(*s));
203 203
  __asm __volatile("movq	%0, %%mm4"::"m"(mask15s));
204
  mm_end = (uint8_t*)((((unsigned long)end)/16)*16);
204
  mm_end = end - 15;
205 205
  while(s<mm_end)
206 206
  {
207 207
	__asm __volatile(
......
225 225
  __asm __volatile(SFENCE:::"memory");
226 226
  __asm __volatile(EMMS:::"memory");
227 227
#endif
228
    mm_end = (uint8_t*)((((unsigned long)end)/4)*4);
228
    mm_end = end - 3;
229 229
    while(s < mm_end)
230 230
    {
231 231
	register unsigned x= *((uint32_t *)s);
......
266 266
	    "movq	%0, %%mm7\n\t"
267 267
	    "movq	%1, %%mm6\n\t"
268 268
	    ::"m"(red_16mask),"m"(green_16mask));
269
	mm_end = (uint8_t*)((((unsigned long)end)/16)*16);
269
	mm_end = end - 15;
270 270
	while(s < mm_end)
271 271
	{
272 272
	    __asm __volatile(
......
330 330
	    "movq	%0, %%mm7\n\t"
331 331
	    "movq	%1, %%mm6\n\t"
332 332
	    ::"m"(red_15mask),"m"(green_15mask));
333
	mm_end = (uint8_t*)((((unsigned long)end)/16)*16);
333
	mm_end = end - 15;
334 334
	while(s < mm_end)
335 335
	{
336 336
	    __asm __volatile(
......
394 394
	    "movq	%0, %%mm7\n\t"
395 395
	    "movq	%1, %%mm6\n\t"
396 396
	    ::"m"(red_16mask),"m"(green_16mask));
397
	mm_end = (uint8_t*)((((unsigned long)end)/16)*16);
397
	mm_end = end - 11;
398 398
	while(s < mm_end)
399 399
	{
400 400
	    __asm __volatile(
......
457 457
	    "movq	%0, %%mm7\n\t"
458 458
	    "movq	%1, %%mm6\n\t"
459 459
	    ::"m"(red_15mask),"m"(green_15mask));
460
	mm_end = (uint8_t*)((((unsigned long)end)/16)*16);
460
	mm_end = end - 11;
461 461
	while(s < mm_end)
462 462
	{
463 463
	    __asm __volatile(
......
539 539
	end = s + src_size/2;
540 540
#ifdef HAVE_MMX
541 541
	__asm __volatile(PREFETCH"	%0"::"m"(*s):"memory");
542
	mm_end = (uint16_t*)((((unsigned long)end)/8)*8);
542
	mm_end = end - 7;
543 543
	while(s < mm_end)
544 544
	{
545 545
	    __asm __volatile(
......
681 681
	end = s + src_size/2;
682 682
#ifdef HAVE_MMX
683 683
	__asm __volatile(PREFETCH"	%0"::"m"(*s):"memory");
684
	mm_end = (uint16_t*)((((unsigned long)end)/8)*8);
684
	mm_end = end - 7;
685 685
	while(s < mm_end)
686 686
	{
687 687
	    __asm __volatile(
......
823 823
#ifdef HAVE_MMX
824 824
	__asm __volatile(PREFETCH"	%0"::"m"(*s):"memory");
825 825
	__asm __volatile("pxor	%%mm7,%%mm7\n\t":::"memory");
826
	mm_end = (uint16_t*)((((unsigned long)end)/4)*4);
826
	mm_end = end - 3;
827 827
	while(s < mm_end)
828 828
	{
829 829
	    __asm __volatile(
......
888 888
#ifdef HAVE_MMX
889 889
	__asm __volatile(PREFETCH"	%0"::"m"(*s):"memory");
890 890
	__asm __volatile("pxor	%%mm7,%%mm7\n\t":::"memory");
891
	mm_end = (uint16_t*)((((unsigned long)end)/4)*4);
891
	mm_end = end - 3;
892 892
	while(s < mm_end)
893 893
	{
894 894
	    __asm __volatile(
......
964 964
		"addl $8, %%eax			\n\t"
965 965
		"cmpl %2, %%eax			\n\t"
966 966
		" jb 1b				\n\t"
967
		:: "r" (src), "r"(dst), "r" (src_size)
967
		:: "r" (src), "r"(dst), "r" (src_size-7)
968 968
		: "%eax"
969 969
	);
970 970

  

Also available in: Unified diff