diff --git a/Others/libyuv/1.0.0/24.03-lts-sp1/Dockerfile b/Others/libyuv/1.0.0/24.03-lts-sp1/Dockerfile index 4ad40a0fadc337db49ccb62a87456714a23e51ec..ae6bc1a9a806c115fea0e8f8af98a2d6d5b48d69 100644 --- a/Others/libyuv/1.0.0/24.03-lts-sp1/Dockerfile +++ b/Others/libyuv/1.0.0/24.03-lts-sp1/Dockerfile @@ -16,4 +16,6 @@ RUN git clone https://chromium.googlesource.com/libyuv/libyuv \ && make -j$(nproc) \ && make install +ENV LD_LIBRARY_PATH=/usr/local/lib:/libyuv/build:$LD_LIBRARY_PATH + CMD ["bash"] \ No newline at end of file diff --git a/Others/libyuv/README.md b/Others/libyuv/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ce404f768a0f7ac691217f32b038d29176815914 --- /dev/null +++ b/Others/libyuv/README.md @@ -0,0 +1,97 @@ +# Quick reference + +- The official LibYuv docker image. + +- Maintained by: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative). + +- Where to get help: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative), [openEuler](https://gitee.com/openeuler/community). + +# LibYuv | openEuler +Current LibYuv docker images are built on the [openEuler](https://repo.openeuler.org/). This repository is free to use and exempted from per-user rate limits. + +LibYuv is an open source project that includes YUV scaling and conversion functionality. + +# Supported tags and respective Dockerfile links +The tag of each `libyuv` docker image is consist of the version of `libyuv` and the version of basic image. The details are as follows +| Tag | Currently | Architectures | +|----------|-------------|------------------| +|[1.0.0-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/libyuv/1.0.0/24.03-lts-sp1/Dockerfile)| LibYuv main on openEuler 24.03-LTS-SP1 | amd64, arm64 | + +# Usage +In this usage, users can select the corresponding `{Tag}` based on their requirements. + +- Pull the `openeuler/libyuv` image from docker + + ``` + docker pull openeuler/libyuv:{Tag} + ``` + +- To run and enter the libyuv container with an interactive shell: + + ``` + docker run -it --rm openeuler/libyuv:{Tag} bash + ``` + +- Example Code (example.cpp) + + This example demonstrates how to use LibYUV to convert an NV12(YUV420SP) image to RGB24 format and save it as a PPM file. + + ``` + #include + #include + #include + #include + + int main() { + const int width = 640; + const int height = 480; + const int y_size = width * height; + const int uv_size = y_size / 2; + + uint8_t* src_y = new uint8_t[y_size]; + uint8_t* src_uv = new uint8_t[uv_size]; + uint8_t* dst_rgb = new uint8_t[width * height * 3]; // RGB24 + + memset(src_y, 0x80, y_size); + memset(src_uv, 0x80, uv_size); + + // NV12 转 RGB24 + libyuv::NV12ToRGB24( + src_y, width, + src_uv, width, + dst_rgb, width * 3, + width, height + ); + + std::ofstream out("output.ppm", std::ios::binary); + out << "P6\n" << width << " " << height << "\n255\n"; + out.write(reinterpret_cast(dst_rgb), width * height * 3); + out.close(); + + delete[] src_y; + delete[] src_uv; + delete[] dst_rgb; + + std::cout << "YUV to RGB conversion completed!" << std::endl; + return 0; + } + ``` + +- Compilation Command + + ``` + g++ example.cpp -o example -lyuv + ``` + +- Running the Program + + ``` + ./example + ``` + After execution, the program will: + * Create a test gray YUV image + * Convert it to RGB format + * Save as `output.ppm` in the current directory + +# Question and answering +If you have any questions or want to use some special features, please submit an issue or a pull request on [openeuler-docker-images](https://gitee.com/openeuler/openeuler-docker-images). \ No newline at end of file diff --git a/Others/libyuv/doc/image-info.yml b/Others/libyuv/doc/image-info.yml new file mode 100644 index 0000000000000000000000000000000000000000..de7aebef1ea4f459d6a42c2c1b01fa736791e887 --- /dev/null +++ b/Others/libyuv/doc/image-info.yml @@ -0,0 +1,93 @@ +name: libyuv +category: others +description: LibYUV 是 Google 开发的高性能 YUV 图像处理库。 +environment: | + 本应用在Docker环境中运行,安装Docker执行如下命令 + ``` + yum install -y docker + ``` +tags: | + libyuv镜像的Tag由其版本信息和基础镜像版本信息组成,详细内容如下 + + | Tag | Currently | Architectures | + |----------|-------------|------------------| + |[1.0.0-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/libyuv/1.0.0/24.03-lts-sp1/Dockerfile)| LibYuv main on openEuler 24.03-LTS-SP1 | amd64, arm64 | + +download: | + 拉取镜像到本地 + ``` + docker pull openeuler/libyuv:{Tag} + ``` + +usage: | + - 进入容器交互式终端 + ``` + docker run -it --rm openeuler/libyuv:{Tag} bash + ``` + 用户可根据自身需求选择对应版本的{Tag}。 + + - 示例代码(example.cpp) + + 本示例演示了如何使用LibYUV将NV12(YUV420SP)格式的图像转换为RGB24格式,并保存为PPM文件。 + ``` + #include + #include + #include + #include + + int main() { + const int width = 640; + const int height = 480; + const int y_size = width * height; + const int uv_size = y_size / 2; + + uint8_t* src_y = new uint8_t[y_size]; + uint8_t* src_uv = new uint8_t[uv_size]; + uint8_t* dst_rgb = new uint8_t[width * height * 3]; // RGB24 + + memset(src_y, 0x80, y_size); + memset(src_uv, 0x80, uv_size); + + // NV12 转 RGB24 + libyuv::NV12ToRGB24( + src_y, width, + src_uv, width, + dst_rgb, width * 3, + width, height + ); + + std::ofstream out("output.ppm", std::ios::binary); + out << "P6\n" << width << " " << height << "\n255\n"; + out.write(reinterpret_cast(dst_rgb), width * height * 3); + out.close(); + + delete[] src_y; + delete[] src_uv; + delete[] dst_rgb; + + std::cout << "YUV to RGB conversion completed!" << std::endl; + return 0; + } + ``` + + - 编译命令 + + ``` + g++ example.cpp -o example -lyuv + ``` + + - 运行程序 + + ``` + ./example + ``` + 程序运行后将会: + * 创建一个测试用的灰度YUV图像 + * 将其转换为RGB格式 + * 在当前目录保存为`output.ppm`文件 + +license: BSD 3-Clause License +similar_packages: + - FFmpeg: FFmpeg 是一个跨平台的开源音视频处理工具链。 +dependency: + - N/A \ No newline at end of file diff --git a/Others/libyuv/doc/picture/logo.png b/Others/libyuv/doc/picture/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..d5e53d62ce3033cd5a8bd8d55e6785488b034f2a Binary files /dev/null and b/Others/libyuv/doc/picture/logo.png differ