From 7603c0b39a93be28006e7c858564b41c21bbcbf3 Mon Sep 17 00:00:00 2001 From: GuangJie1 Date: Wed, 2 Jul 2025 16:44:00 +0800 Subject: [PATCH 1/2] add libyuv readme --- Others/libyuv/1.0.0/24.03-lts-sp1/Dockerfile | 2 + Others/libyuv/README.md | 97 +++++++++++++++++++ Others/libyuv/doc/image-info.yml | 93 ++++++++++++++++++ Others/libyuv/doc/picture/logo.png | Bin 0 -> 2233 bytes 4 files changed, 192 insertions(+) create mode 100644 Others/libyuv/README.md create mode 100644 Others/libyuv/doc/image-info.yml create mode 100644 Others/libyuv/doc/picture/logo.png 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 4ad40a0f..ae6bc1a9 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 00000000..ce404f76 --- /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 00000000..93bfb148 --- /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 GIT binary patch literal 2233 zcmb7F`#Teg8=nfXq>;(xq_gFIE7!B!qOG~)I;Lf&G{Q_}j?DF_qnOaD&6x<5ON``F zVI*=4b18Bum$FS(xoqwVXMO*IZ}0QG*U#sDpZ9rxdDA@HkaDuBvH$=;&dCw(1pr9! z#BtT`onk9EFneF@BuHLJ2S8=7x}t)yin{mK3z&5yD;}6wEdPCl)2=HApro&pr0zyrL|}W07#3R;P&1z zxY<0yy(yi2DeqzkMB?`LlRRx1pRqF8z?sXfxvSlCT4s1y?hd`u#@~Kvv9+X8jo=l5 zT$Sre+Y$9UgtpLN$I5HO$oqpV?8EeZ_4e%LMNkn4lf?-n)u?%7BWj~n=bwM8vANBe#VZw(yr>AX`LA5(8O-!j>tTD zl%1WcUU`E=Iz=waE$fC(tY zy)M-D_iAELnNW#eicaNxK|IvresZSmd1)`MhXz?hV!5(Z*xnDK&e`Z!Ncc0Rff|{{ z=6RapfN_fvYpLw(G$rU01;*-0G^?1=$jX~Im=9tQ@9=-y|Fhh27xaWIH!-fYejZY; zA|BW9*k9A+v;J~SPg~_QjW@J*i#=A-S$wyw+xodP-i`Rh?<{2q6Cy}nfy~d(Np5qI zmYIR#KCqc@8fSjrJ3Lta+R`3B<-zn*H;ksX+!4*BvKZd_LxkOER~glp!Wq5fdP1)t z^QtS#I8v`9YPm&96DQy~JEDg&SYCJ>I#ig$jHr0|+yzA?Co4Y4t-Q?)Kb$v|#z9q1 zd1ns&yQ}7$DkVMxQukSR6&n#m2*m1|$mJuc6kMjl@#d1+OJKbf4};_gK!31*wqh*y@%d^Sl6;sCuUe9TEBVl1k2kDzoh{DOTT|+iE5XqxS5? zM!Bm3Z2FyfX-EYixgHu7JF?o-e(5C4O9*P^7vY){HdEAQHe)bA~yecZYC@vPN4;)*Dkitw8 z6evS^5x4JAa&No>Spi>FOtM83s#+?iO((&F^7|CH0GN};TyN=hxD_oQ$qM92K}brS zHoXLb>&5(F2%*W{mYVhM(&ApSPAv!nYe!`BrN3Pj1GXOx;IZeguXZUKSJ1(bnjkJu zv#D{$tO)kj8P8vK6H2;=2l=;3LAvczirk0K|Mtci|I}BzRD!&%hQVM9`fB$vt~nnt z4tbL|&)g`au{Yk{<$-1zZrJ6KEGWzCQHWs{#chqn#J0A-7G&izF)mq$}uzhJ13EK|PjO3H(s@xI=*Su#b zM`%@8z32_&mrL-a%HY%ES<`Q1jA#>Qbx<}Pgs#lfUpMyZ5RS7W-}?NSkD*s#179n> zMGow4@_bwVKmo;~zf7vMJCnwYCNvCo>Y|U@*HplCJ8YF?`Zhdj=V1RkvEdX(BjNI3 z8b?kg6nOvg^1rP$_@$?mX3I`P1bWD*$lk-y#I6+N_gG6G)bsgb!i+`yq;wCQt~u3r zNadpF3mn~CWcg?zSzDTzA+J7`G1C7NJ%R6>fzlw0f{7CF{X&DSN+0|rp^Ex|4@CdK(Zq|q(0Di@i=EU7|12E(?D zt_`mq$!h%$YrugGV@%>2-vKM&2iM{|f(~3K4Q5F$e?d&!+)ie!ZKY9i{c$d^p#QVV8f*|uN$?{MmB_iy{C8j#~LvazCn^h*2 z^v@j03{0_(_(xQ*X>HtjeDM!~UD3MQSfUXr=d0+&_5+ud)laQ<`DEC3FzT1y?f*lD Z|B%>7h?hMU4ygV~cS5+qD;>^W{SQxK@4x^6 literal 0 HcmV?d00001 -- Gitee From f45d061312241defa2527c2f3cf074f84510774e Mon Sep 17 00:00:00 2001 From: GuangJie1 Date: Wed, 2 Jul 2025 16:52:23 +0800 Subject: [PATCH 2/2] update image info --- Others/libyuv/doc/image-info.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Others/libyuv/doc/image-info.yml b/Others/libyuv/doc/image-info.yml index 93bfb148..de7aebef 100644 --- a/Others/libyuv/doc/image-info.yml +++ b/Others/libyuv/doc/image-info.yml @@ -30,7 +30,7 @@ usage: | 本示例演示了如何使用LibYUV将NV12(YUV420SP)格式的图像转换为RGB24格式,并保存为PPM文件。 ``` - #include + #include #include #include #include @@ -74,7 +74,7 @@ usage: | ``` g++ example.cpp -o example -lyuv - ``` + ``` - 运行程序 -- Gitee