⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 idb_streamc.i

📁 H.264完整的C语言代码和DCT的代码
💻 I
📖 第 1 页 / 共 5 页
字号:
{
  T *ptr;
  if (used == sz)
  {
    sz = sz ? (sz*2) : 4;
    T *newdata = allocate(sz);
    ptr = newdata;
    for (unsigned int i=0; i<used; i++, ptr++)
      ptr = new ((void *) ptr) T(data[i]);

    int newsize = sz;
    int newused = used;
    destroy();

    delop = &operator delete;

    sz   = newsize;
    used = newused;
    data = newdata;
  }
  ptr = &data[used++];
  ptr = new ((void *) ptr) T(el);
}

template<class T>
void vector<T>::push_back(const vector<T>& v)
{
  for (int i = 0; i < v.size(); i++) {
    push_back(v[i]);
  }
}

template<class T>
T vector<T>::pop_back()
{
  ((void)0);
  T *ptr = &data[--used];
  T val = *ptr;
  ptr->~T();

  if ((used < (sz/4)) && (sz > 4))
  {
    sz /= 2;
    T *newdata = allocate(sz);
    ptr = newdata;
    for (unsigned int i=0; i<used; i++, ptr++)
      ptr = new ((void *) ptr) T(data[i]);

    int newsize = sz;
    int newused = used;
    destroy();

    delop = &operator delete;

    sz   = newsize;
    used = newused;
    data = newdata;
  }
  return val;
}

template<class T>
T& vector<T>::operator[](const unsigned int i)
{
  ((void)0);
  return data[i];
}

template<class T>
const T& vector<T>::operator[](const unsigned int i) const
{
  ((void)0);
  return data[i];
}

template<class T>
VPtr<T> vector<T>::begin()
{
  VPtr<T> p;

  if (used)
  {
    p.idx = 0;
    p.v   = this;
  }

  return p;
}

template<class T>
VPtr<T> vector<T>::end()
{
  VPtr<T> p;

  if (used)
  {
    p.idx = used-1;
    p.v   = this;
  }

  return p;
}

template<class T>
VPtr<T> vector<T>::getPtr(const unsigned int i)
{
  VPtr<T> p;

  if (i < used)
  {
    p.idx = i;
    p.v   = this;
  }

  return p;
}

template<class T>
vector<T>::operator portable_vector() const
{
  portable_vector pv;

  pv.datasz = sizeof(T);
  pv.len    = used;
  pv.data   = operator new(used * sizeof(T));
  pv.delop  = &operator delete;

  T *ptr = data;
  T *el  = (T *) pv.data;
  for (unsigned int i=0; i<sz; i++, ptr++, el++)
    el = new ((void *) el) T(*ptr);

  return pv;
}

template<class T>
char* vector<T>::writeBin(const unsigned int bin_size)
{
  destroy();
  unsigned int T_size = bin_size / sizeof(T) + (bin_size % sizeof(T) == 0 ? 0 : 1);
  sz = T_size + 4;
  used = T_size;
  data = allocate(sz);
  delop = &operator delete;
  
  return((char*)data);
}

template<class T>
char* vector<T>::readBin(unsigned int& bin_size)
{
  bin_size = used * sizeof(T);

  return((char*)data);
}
#line 145 "D:/working/tools/isim\\vector.hpp"

#line 147 "D:/working/tools/isim\\vector.hpp"
#line 39 "D:/working/tools/isim\\misc.hpp"







int __declspec(dllexport) divRoundUp(int a, int b);

int __declspec(dllexport) exactLog2(int a);
int __declspec(dllexport) ceilLog2(int a);

int __declspec(dllexport) bitReverse(int numBits, int a);

void __declspec(dllexport) test_error(bool condition, char* error_msg, ...);
void __declspec(dllexport) test_warning(bool condition, char* error_msg, ...);

void __declspec(dllexport) swap(int& a, int& b);

int __declspec(dllexport) roundUpToNearest(int a, int b);

String __declspec(dllexport) cutTo(String& main, const String& sub);

void __declspec(dllexport) printIndent(ostream& out, int indent);

void __declspec(dllexport) expandFSpec(String fspec, vector<String>& fnames); 












template<class T>
void deleteVectObjPtr(vector<T*>& vect) 


{ 
  int vectSize = vect.size(); 
  if (true) for (int i = 0; i < vectSize; ++i) {
    T* obj = vect[i];
    delete obj; 
	vect[i] = 0; 
  }
  vect.clear();  
}



template <class T>
void streamIOBasic(T& t, istream* i, ostream* o, unsigned int indent)

{
  if (i) {
    *i >> t;
  } else {
    *o << t << " ";
  }
}

#pragma warning (disable: 4800)


template <class T>
void streamIOEnum(T& t, istream* i, ostream* o, unsigned int indent)

{
  if (i) {
    unsigned int dummy;
    *i >> dummy;
    t = (T)dummy;
  } else {
    unsigned int dummy = (unsigned int)t;
    *o << dummy << " ";
  }
}

#line 122 "D:/working/tools/isim\\misc.hpp"

#line 14 "D:/working/tools/isim/isimhostdll2/sc_streamraw.hpp"

typedef unsigned int             uint; 
typedef unsigned __int32         uint32;






enum IOTypeEnum
{
  ioIn,
  ioOut,
  ioBoth,
  ioInvalid
};




enum StreamFlagsEnum 
{
  im_countup = 1,
  im_align = 8,
  im_incr = 16,
  im_cacheable = 1024,
  im_countup_align = im_countup | im_align,
  im_countup_incr = im_countup | im_incr,
  im_align_incr = im_align | im_incr,
  im_countup_align_incr = im_countup | im_align | im_incr,
  im_countup_align_cacheable = im_countup | im_align | im_cacheable,
  im_countup_incr_cacheable = im_countup | im_incr | im_cacheable,
  im_align_incr_cacheable = im_align | im_incr | im_cacheable,
  im_countup_align_incr_cacheable = im_countup | im_align | im_incr | im_cacheable,
};

enum StreamPrivateFlagsEnum 
{
  im_pvt_fixed = 0,
  im_pvt_var_size = 2,
  im_pvt_var_pos = 4,
  im_pvt_strip_none = 64,
  im_pvt_strip_extra = 128,
  im_pvt_strip_ignore = 256
};



enum StreamAccessEnum 
{
  im_acc_stride = 0, 
  im_acc_index = 1,
  im_acc_bit_reverse = 2
};


enum OpAndStoreEnum { memop_none, memop_int32_add, memop_uint32_add, memop_fp32_add };








const int DefaultStride = (1 << 30);


class __declspec(dllexport) StreamRaw


{
public:





  
  bool                        valid;

  
  unsigned int                start;
  unsigned int                end;

  
  unsigned int                size;

  
  StreamAccessEnum            accessType;
  
  int                         stride;
  
  StreamRaw*                  index;
 
  
  unsigned int                recLength;

  
  unsigned int                flags;
  bool                        countup;
  bool                        varSize;
  bool                        varPos;
  bool                        varAlign;
  bool                        varIncr;
  bool                        cacheable;    

  String                      debugName;

  
  StreamRaw();
  StreamRaw(const StreamRaw& s);
  virtual ~StreamRaw();
  StreamRaw& operator=(const StreamRaw& s);

  void initNew(unsigned int _size, unsigned int _flags, 
    unsigned int _recLength);
  void initCopy(const StreamRaw* s);
  
  
  virtual StreamRaw* allocCopy();
  void initDerived(const StreamRaw* s, 
    unsigned int _start, unsigned int _end, unsigned int _flags,
    StreamAccessEnum _accessType, int _stride, StreamRaw* _index,
    unsigned int _recLength, bool coordWords);
  void updateSize();
  virtual void destroy();

  unsigned int getSize(bool coordWords = false);
  String& getName() { return debugName; } 







};

int streamDist(int p0, int p1, StreamRaw& s, int blockSize, int numClusters);
int streamSize(int p0, int p1, StreamRaw& s, int blockSize); 

#line 157 "D:/working/tools/isim/isimhostdll2/sc_streamraw.hpp"
#line 16 "D:/working/tools/isim/isimhostdll2/idb_streamraw.hpp"


















class IDebugScheduler;
class IdbStreamData;


class __declspec(dllexport) IdbStreamRaw : public StreamRaw


{
public:
  
  IdbStreamData*                 streamData;

  int                            streamDataImIdx;
  int                            streamDataSize;
  bool                           derived;
#line 50 "D:/working/tools/isim/isimhostdll2/idb_streamraw.hpp"

  
  unsigned int                   length;
  AsynchConsumer                 consumer;

  IdbStreamRaw();
  IdbStreamRaw(IdbStreamRaw& s);
  ~IdbStreamRaw();
  IdbStreamRaw& operator=(IdbStreamRaw& s);

  void initNew(unsigned int _size, unsigned int _flags, 
    unsigned int _recLength);
  void initCopy(IdbStreamRaw* s);
  StreamRaw* allocCopy();
  void initDerived(const IdbStreamRaw* s, 
    unsigned int _start, unsigned int _end, unsigned int _flags,
    StreamAccessEnum _accessType, int _stride, IdbStreamRaw* _index,
    unsigned int _recLength, bool coordWords);
  void destroy();

  unsigned int const getLength(bool coordWords = false);
  int const getLengthDebugOnly(bool coordWords = false);

  int resolvePos(int pos, unsigned int numClusters, 
                 unsigned int clusterRecLength);












  
  inline unsigned int const __getLength() { return length; }
  inline void __setLength(unsigned int _length) { length = _length; } 
};






























#line 122 "D:/working/tools/isim/isimhostdll2/idb_streamraw.hpp"
#line 41 "D:/working/tools/isim/isimhostdll2/idb_types.hpp"
#line 1 "D:/working/tools/isim/isimhostdll2/sc_kernel.hpp"











#line 1 "D:/working/tools/isim\\libapi.hpp"







































































#line 13 "D:/working/tools/isim/isimhostdll2/sc_kernel.hpp"
#line 1 "D:/working/tools/isim\\string.hpp"





















































































































#line 14 "D:/working/tools/isim/isimhostdll2/sc_kernel.hpp"
#line 1 "D:/working/tools/isim/isimhostdll2/sc_streamraw.hpp"




























































































































































#line 15 "D:/working/tools/isim/isimhostdll2/sc_kernel.hpp"






enum KernelArgTypeEnum { 
  argInvalid, 
  argStream, 
  argStreamRestartable,
  argUC
};























































































































#line 147 "D:/working/tools/isim/isimhostdll2/sc_kernel.hpp"
#line 42 "D:/working/tools/isim/isimhostdll2/idb_types.hpp"





#line 1 "D:/working/tools/isim/isimhostdll2/sc_route.hpp"










#line 1 "D:/working/tools/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -