• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavutil/tomi/intreadwrite.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2010 Mans Rullgard <mans@mansr.com>
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * FFmpeg is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with FFmpeg; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #ifndef AVUTIL_TOMI_INTREADWRITE_H
00022 #define AVUTIL_TOMI_INTREADWRITE_H
00023 
00024 #include <stdint.h>
00025 #include "config.h"
00026 
00027 #define AV_RB16 AV_RB16
00028 static av_always_inline uint16_t AV_RB16(const void *p)
00029 {
00030     uint16_t v;
00031     __asm__ ("loadacc,   (%1+) \n\t"
00032              "rol8             \n\t"
00033              "storeacc,  %0    \n\t"
00034              "loadacc,   (%1+) \n\t"
00035              "add,       %0    \n\t"
00036              : "=r"(v), "+a"(p));
00037     return v;
00038 }
00039 
00040 #define AV_WB16 AV_WB16
00041 static av_always_inline void AV_WB16(void *p, uint16_t v)
00042 {
00043     __asm__ volatile ("loadacc,   %1    \n\t"
00044                       "lsr8             \n\t"
00045                       "storeacc,  (%0+) \n\t"
00046                       "loadacc,   %1    \n\t"
00047                       "storeacc,  (%0+) \n\t"
00048                       : "+&a"(p) : "r"(v));
00049 }
00050 
00051 #define AV_RL16 AV_RL16
00052 static av_always_inline uint16_t AV_RL16(const void *p)
00053 {
00054     uint16_t v;
00055     __asm__ ("loadacc,   (%1+) \n\t"
00056              "storeacc,  %0    \n\t"
00057              "loadacc,   (%1+) \n\t"
00058              "rol8             \n\t"
00059              "add,       %0    \n\t"
00060              : "=r"(v), "+a"(p));
00061     return v;
00062 }
00063 
00064 #define AV_WL16 AV_WL16
00065 static av_always_inline void AV_WL16(void *p, uint16_t v)
00066 {
00067     __asm__ volatile ("loadacc,   %1    \n\t"
00068                       "storeacc,  (%0+) \n\t"
00069                       "lsr8             \n\t"
00070                       "storeacc,  (%0+) \n\t"
00071                       : "+&a"(p) : "r"(v));
00072 }
00073 
00074 #define AV_RB32 AV_RB32
00075 static av_always_inline uint32_t AV_RB32(const void *p)
00076 {
00077     uint32_t v;
00078     __asm__ ("loadacc,   (%1+) \n\t"
00079              "rol8             \n\t"
00080              "rol8             \n\t"
00081              "rol8             \n\t"
00082              "storeacc,  %0    \n\t"
00083              "loadacc,   (%1+) \n\t"
00084              "rol8             \n\t"
00085              "rol8             \n\t"
00086              "add,       %0    \n\t"
00087              "loadacc,   (%1+) \n\t"
00088              "rol8             \n\t"
00089              "add,       %0    \n\t"
00090              "loadacc,   (%1+) \n\t"
00091              "add,       %0    \n\t"
00092              : "=r"(v), "+a"(p));
00093     return v;
00094 }
00095 
00096 #define AV_WB32 AV_WB32
00097 static av_always_inline void AV_WB32(void *p, uint32_t v)
00098 {
00099     __asm__ volatile ("loadacc,   #4    \n\t"
00100                       "add,       %0    \n\t"
00101                       "loadacc,   %1    \n\t"
00102                       "storeacc,  (-%0) \n\t"
00103                       "lsr8             \n\t"
00104                       "storeacc,  (-%0) \n\t"
00105                       "lsr8             \n\t"
00106                       "storeacc,  (-%0) \n\t"
00107                       "lsr8             \n\t"
00108                       "storeacc,  (-%0) \n\t"
00109                       : "+&a"(p) : "r"(v));
00110 }
00111 
00112 #define AV_RL32 AV_RL32
00113 static av_always_inline uint32_t AV_RL32(const void *p)
00114 {
00115     uint32_t v;
00116     __asm__ ("loadacc,   (%1+) \n\t"
00117              "storeacc,  %0    \n\t"
00118              "loadacc,   (%1+) \n\t"
00119              "rol8             \n\t"
00120              "add,       %0    \n\t"
00121              "loadacc,   (%1+) \n\t"
00122              "rol8             \n\t"
00123              "rol8             \n\t"
00124              "add,       %0    \n\t"
00125              "loadacc,   (%1+) \n\t"
00126              "rol8             \n\t"
00127              "rol8             \n\t"
00128              "rol8             \n\t"
00129              "add,       %0    \n\t"
00130              : "=r"(v), "+a"(p));
00131     return v;
00132 }
00133 
00134 #define AV_WL32 AV_WL32
00135 static av_always_inline void AV_WL32(void *p, uint32_t v)
00136 {
00137     __asm__ volatile ("loadacc,   %1    \n\t"
00138                       "storeacc,  (%0+) \n\t"
00139                       "lsr8             \n\t"
00140                       "storeacc,  (%0+) \n\t"
00141                       "lsr8             \n\t"
00142                       "storeacc,  (%0+) \n\t"
00143                       "lsr8             \n\t"
00144                       "storeacc,  (%0+) \n\t"
00145                       : "+&a"(p) : "r"(v));
00146 }
00147 
00148 #endif /* AVUTIL_TOMI_INTREADWRITE_H */

Generated on Fri Sep 16 2011 17:17:51 for FFmpeg by  doxygen 1.7.1