comparison libmpeg2/idct_mmx.c @ 12932:d0a8810e155c

Importing libmpeg2 from mpeg2dec-0.4.0b
author henry
date Mon, 02 Aug 2004 11:26:43 +0000
parents 2c0b6ec77d39
children 96259a2f2142
comparison
equal deleted inserted replaced
12931:0aecf9be9817 12932:d0a8810e155c
26 #ifdef ARCH_X86 26 #ifdef ARCH_X86
27 27
28 #include <inttypes.h> 28 #include <inttypes.h>
29 29
30 #include "mpeg2.h" 30 #include "mpeg2.h"
31 #include "attributes.h"
31 #include "mpeg2_internal.h" 32 #include "mpeg2_internal.h"
32 #include "attributes.h"
33 #include "mmx.h" 33 #include "mmx.h"
34 34
35 #define ROW_SHIFT 11 35 #define ROW_SHIFT 15
36 #define COL_SHIFT 6 36 #define COL_SHIFT 6
37 37
38 #define round(bias) ((int)(((bias)+0.5) * (1<<ROW_SHIFT))) 38 #define round(bias) ((int)(((bias)+0.5) * (1<<ROW_SHIFT)))
39 #define rounder(bias) {round (bias), round (bias)} 39 #define rounder(bias) {round (bias), round (bias)}
40 40
699 } while (0) 699 } while (0)
700 700
701 static inline void block_add_DC (int16_t * const block, uint8_t * dest, 701 static inline void block_add_DC (int16_t * const block, uint8_t * dest,
702 const int stride, const int cpu) 702 const int stride, const int cpu)
703 { 703 {
704 movd_v2r ((block[0] + 4) >> 3, mm0); 704 movd_v2r ((block[0] + 64) >> 7, mm0);
705 pxor_r2r (mm1, mm1); 705 pxor_r2r (mm1, mm1);
706 movq_m2r (*dest, mm2); 706 movq_m2r (*dest, mm2);
707 dup4 (mm0); 707 dup4 (mm0);
708 psubsw_r2r (mm0, mm1); 708 psubsw_r2r (mm0, mm1);
709 packuswb_r2r (mm0, mm0); 709 packuswb_r2r (mm0, mm0);
761 } 761 }
762 762
763 void mpeg2_idct_add_mmxext (const int last, int16_t * const block, 763 void mpeg2_idct_add_mmxext (const int last, int16_t * const block,
764 uint8_t * const dest, const int stride) 764 uint8_t * const dest, const int stride)
765 { 765 {
766 if (last != 129 || (block[0] & 7) == 4) { 766 if (last != 129 || (block[0] & (7 << 4)) == (4 << 4)) {
767 mmxext_idct (block); 767 mmxext_idct (block);
768 block_add (block, dest, stride); 768 block_add (block, dest, stride);
769 block_zero (block); 769 block_zero (block);
770 } else 770 } else
771 block_add_DC (block, dest, stride, CPU_MMXEXT); 771 block_add_DC (block, dest, stride, CPU_MMXEXT);
784 } 784 }
785 785
786 void mpeg2_idct_add_mmx (const int last, int16_t * const block, 786 void mpeg2_idct_add_mmx (const int last, int16_t * const block,
787 uint8_t * const dest, const int stride) 787 uint8_t * const dest, const int stride)
788 { 788 {
789 if (last != 129 || (block[0] & 7) == 4) { 789 if (last != 129 || (block[0] & (7 << 4)) == (4 << 4)) {
790 mmx_idct (block); 790 mmx_idct (block);
791 block_add (block, dest, stride); 791 block_add (block, dest, stride);
792 block_zero (block); 792 block_zero (block);
793 } else 793 } else
794 block_add_DC (block, dest, stride, CPU_MMX); 794 block_add_DC (block, dest, stride, CPU_MMX);