题外话

今天遇到这样一个注释

// BGRA little endian (argb in memory) to ARGB.

在opencv中使用cvtColor, 比如BGR2BGRA,
实际在是用libyuv的时候,(ubuntu)数据存放是argb, 所以数据还是要用libyuv::ARGBTo*进行处理。

判断机器是大端还是小端

#include <iostream>

int checkCPU(){
   union w{  
            int  a;
            char b;
          } c;
    c.a = 1;
    return(c.b ==1);
}
int main() {
    if (checkCPU()){
      std::cout << "little endian" << std::endl;
    } else {
      std::cout << "big endian" << std::endl;
    }
}

1为小端,0为大端

相关文章:

  • 2021-10-22
  • 2021-06-06
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
猜你喜欢
  • 2021-09-07
  • 2021-07-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案