comparison dsputil.h @ 4263:e10af5bd6ff2 libavcodec

Move BE_*/LE_*/ST*/LD* macros to a common place. Some further optimization/cleanup would be desirable (e.g. LE_* and LD* should be the same on x86).
author reimar
date Sun, 03 Dec 2006 16:35:30 +0000
parents e880555ad2c6
children 3a4d4be05618
comparison
equal deleted inserted replaced
4262:cdcfabd40101 4263:e10af5bd6ff2
588 #define DECLARE_ALIGNED_8(t,v) t v __attribute__ ((aligned (8))) 588 #define DECLARE_ALIGNED_8(t,v) t v __attribute__ ((aligned (8)))
589 #define STRIDE_ALIGN 8 589 #define STRIDE_ALIGN 8
590 590
591 #endif 591 #endif
592 592
593 #ifdef __GNUC__
594
595 struct unaligned_64 { uint64_t l; } __attribute__((packed));
596 struct unaligned_32 { uint32_t l; } __attribute__((packed));
597 struct unaligned_16 { uint16_t l; } __attribute__((packed));
598
599 #define LD16(a) (((const struct unaligned_16 *) (a))->l)
600 #define LD32(a) (((const struct unaligned_32 *) (a))->l)
601 #define LD64(a) (((const struct unaligned_64 *) (a))->l)
602
603 #define ST16(a, b) (((struct unaligned_16 *) (a))->l) = (b)
604 #define ST32(a, b) (((struct unaligned_32 *) (a))->l) = (b)
605
606 #else /* __GNUC__ */
607
608 #define LD16(a) (*((uint16_t*)(a)))
609 #define LD32(a) (*((uint32_t*)(a)))
610 #define LD64(a) (*((uint64_t*)(a)))
611
612 #define ST16(a, b) *((uint16_t*)(a)) = (b)
613 #define ST32(a, b) *((uint32_t*)(a)) = (b)
614
615 #endif /* !__GNUC__ */
616
617 /* PSNR */ 593 /* PSNR */
618 void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3], 594 void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3],
619 int orig_linesize[3], int coded_linesize, 595 int orig_linesize[3], int coded_linesize,
620 AVCodecContext *avctx); 596 AVCodecContext *avctx);
621 597