YUV to NV12 conversion

992 views
Skip to first unread message

Yaroslav Taran

unread,
Apr 16, 2020, 12:48:50 PM4/16/20
to discuss-libyuv
Hi Guys,
Need your help.
I have to convert YUV image to NV12 format.
Please help me.

I have YUV 640x400  image placed in memory in the following order:
For Y 640x400 buffer size, after it U 640x400 size and after it  V 640x400 size.
It is YUV 888 like format.
I need to convert it to NV12 YUV 640x400 image.
How to use Libyuv library for this conversion properly ? Which function to use?

Thank you,
Slava

Frank Barchard

unread,
Apr 16, 2020, 1:32:47 PM4/16/20
to discuss...@googlegroups.com
The function you're looking for is
I444ToNV12()

I444 is YUV with bt.601 color space and 444 subsampling, meaning full size chroma channels.
I420 is more common, with half sized chroma channels.
When calling the function you'll need to provide the appropriate row stride values for the YUV, depending which format it is.
If its I444 you can pass width for y_stride, u_stride and v_stride

To determine if I444ToNV12 exists I ran the unittests, and it does not
libyuv_test '--gunit_filter=*ToNV12_Opt' --libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=1000 --libyuv_flags=-1 --libyuv_cpu_info=-1
These are the conversions to NV12
I420ToNV12_Opt (141 ms)
NV21ToNV12_Opt (108 ms)
ARGBToNV12_Opt (237 ms)
ABGRToNV12_Opt (234 ms)
YUY2ToNV12_Opt (136 ms)
UYVYToNV12_Opt (136 ms)
AYUVToNV12_Opt (491 ms)

Please confirm you actually have 444 subsampling, not 420.  Are you U and V planes 640x400, just like the Y plane, or are they half sized 320x200?
If you need I444 there are 4 options
1. you can request the function be added.
2. you can do a 2 step conversion.
For YUV formats, I420 is supported for every conversion, so convert to and from that.
I444ToI420 then I420ToNV12
3. planar conversions
I444, I420 and NV12 all have the same Y plane format.  So copy that with CopyPlane()
I420 and NV12 both have half sized U and V planes.
The difference is I420 has 2 planes, while NV12 has a single packed plane containing U and V weaved together.
I444ToI420 is implemented using ScalePlane to scale the U and V planes to half sized.
And then call MergeUVPlane
4. I444ToNV21
When I took a look at the code, I did find I444ToNV21.
The only difference between NV21 and NV12 is the UV is reversed.  So you could call that with the source U and V pointers swapped.




--
You received this message because you are subscribed to the Google Groups "discuss-libyuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-libyu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-libyuv/43d46535-0223-464a-9a18-b50df8429728%40googlegroups.com.

Frank Barchard

unread,
Apr 16, 2020, 2:30:32 PM4/16/20
to discuss...@googlegroups.com
I've created an I444ToNV12 locally and tested performance on x64 for 720p for all conversions:
I420ToNV12_Opt (107 ms)
I444ToNV12_Opt (195 ms)
NV21ToNV12_Opt (104 ms)
ARGBToNV12_Opt (232 ms)
ABGRToNV12_Opt (231 ms)

YUY2ToNV12_Opt (136 ms)
UYVYToNV12_Opt (136 ms)
AYUVToNV12_Opt (494 ms)
Performance (195ms) is a bit disappointing and would benefit from a row by row subsample, but I tried that for I422ToNV12 and had issues.  The code is still there and commented out with an ifdef.

if you want this function, please post an issue here:
and I'll upstream it right away.  Otherwise I'll still do it, but not right away.

Yaroslav Taran

unread,
Apr 16, 2020, 4:07:49 PM4/16/20
to discuss...@googlegroups.com
Thank you so much,
I am going to test it.

Yaroslav Taran

unread,
Apr 16, 2020, 4:21:31 PM4/16/20
to discuss...@googlegroups.com
How to add an issue there?

Thanks,
Slava

On Thu, Apr 16, 2020 at 2:30 PM 'Frank Barchard' via discuss-libyuv <discuss...@googlegroups.com> wrote:

Yaroslav Taran

unread,
Apr 16, 2020, 4:45:05 PM4/16/20
to discuss...@googlegroups.com
I added the issue.

Than you,
SLava

Yaroslav Taran

unread,
Apr 17, 2020, 9:13:39 AM4/17/20
to discuss...@googlegroups.com
Hi,
What branch number for new I444ToNV12 update ?

Thanks,
Slava


On Thu, Apr 16, 2020 at 2:30 PM 'Frank Barchard' via discuss-libyuv <discuss...@googlegroups.com> wrote:

Frank Barchard

unread,
Apr 17, 2020, 1:02:36 PM4/17/20
to discuss...@googlegroups.com
On Fri, Apr 17, 2020 at 6:13 AM Yaroslav Taran <yar....@gmail.com> wrote:
Hi,
What branch number for new I444ToNV12 update ?

Yaroslav Taran

unread,
Apr 17, 2020, 4:53:23 PM4/17/20
to discuss...@googlegroups.com
Thank you so much,
I try to integrate in my project the libyuv.a library in Eclipse 4.15.0, but get an error (see below).
I added the library in project properties -> Paths and Symbols and tried everything, but linker still doesn't see this static library...
I ran this command to build the libyuv.a, may be I should run another command? : make -f linux.mk


Build output:

make all
Building target: helloc_plus_plus.elf
Invoking: GCC C++ Linker
g++ -static -L"/home/alex-linux/TI/helloc_plus_plus/lib" -o "helloc_plus_plus.elf"  ./VidFile/VideoOpener.o ./VidFile/svsLinux.o ./VidFile/vidFileEx.o ./VidFile/vid_save_bmp.o  ./MECL/model/ViewGen_Hydra2.o  ./MECL/core/MatCalcIndex.o ./MECL/core/MeclAssert.o ./MECL/core/MeclLogging.o  ./main.o   -l"/home/alex-linux/TI/helloc_plus_plus/lib/yuv.a"
/usr/bin/ld: cannot find -l/home/alex-linux/TI/helloc_plus_plus/lib/yuv.a
collect2: error: ld returned 1 exit status
makefile:47: recipe for target 'helloc_plus_plus.elf' failed
make: *** [helloc_plus_plus.elf] Error 1
"make all" terminated with exit code 2. Build might be incomplete.


Frank Barchard

unread,
Apr 20, 2020, 9:09:03 AM4/20/20
to discuss...@googlegroups.com
make -f linux.mk

produces the library  libyuv.a
you'll see the last few builds are examples that link the library

g++ -O2 -fomit-frame-pointer -Iinclude/ -Iutil/ -o yuvconvert util/yuvconvert.cc libyuv.a
cc -O2 -fomit-frame-pointer -Iinclude/ -o cpuid util/cpuid.c libyuv.a
g++ -O2 -fomit-frame-pointer -Iinclude/ -Iutil/ -o psnr util/psnr.cc util/psnr_main.cc util/ssim.cc


Yaroslav Taran

unread,
Apr 20, 2020, 12:10:40 PM4/20/20
to discuss...@googlegroups.com
Could you elaborate ?
Should i run the project build from command line ?
I can't just configure the linker from Eclipse environment ?

Thanks,

Slava

Frank Barchard

unread,
Apr 20, 2020, 4:18:12 PM4/20/20
to discuss...@googlegroups.com
On Mon, Apr 20, 2020 at 9:10 AM Yaroslav Taran <yar....@gmail.com> wrote:
Could you elaborate ?

From the looks of your build error, you attempted to link a library that hasn't been built?
libyuv comes as source code.  so the first step is to build the library, or add the source to your project.
 
Should i run the project build from command line ?
I can't just configure the linker from Eclipse environment ?

I'm not sure how you built libyuv, and I dont know the Eclipse environment, but if you ended up with libyuv.a you can provide that to the linker line without -l or if you want to use -l use just the name -l yuv and -L for the path to find libyuv.a in
The linux.mk produces an x64 library by default and is the simplest example of building libyuv and linking it into examples.

The supported build for git is ninja, chromium style.
gn gen out/Release --args=is_debug=false
ninja -v -C out/Release

See Also




 

Yaroslav Taran

unread,
Apr 20, 2020, 7:00:57 PM4/20/20
to discuss...@googlegroups.com
When I run this command:
make V=1 -f linux.mk CXX=clang++

I get the error:

alex-linux@LinuxV18:~/libyuv/libyuv$ make V=1 -f linux.mk CXX=clang++
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/compare.cc -o source/compare.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/compare_common.cc -o source/compare_common.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/compare_gcc.cc -o source/compare_gcc.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/compare_mmi.cc -o source/compare_mmi.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/compare_msa.cc -o source/compare_msa.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/compare_neon64.cc -o source/compare_neon64.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/compare_neon.cc -o source/compare_neon.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/compare_win.cc -o source/compare_win.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/convert_argb.cc -o source/convert_argb.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/convert.cc -o source/convert.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/convert_from_argb.cc -o source/convert_from_argb.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/convert_from.cc -o source/convert_from.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/convert_jpeg.cc -o source/convert_jpeg.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/convert_to_argb.cc -o source/convert_to_argb.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/convert_to_i420.cc -o source/convert_to_i420.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/cpu_id.cc -o source/cpu_id.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/mjpeg_decoder.cc -o source/mjpeg_decoder.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/mjpeg_validate.cc -o source/mjpeg_validate.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/planar_functions.cc -o source/planar_functions.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/rotate_any.cc -o source/rotate_any.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/rotate_argb.cc -o source/rotate_argb.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/rotate.cc -o source/rotate.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/rotate_common.cc -o source/rotate_common.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/rotate_gcc.cc -o source/rotate_gcc.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/rotate_mmi.cc -o source/rotate_mmi.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/rotate_msa.cc -o source/rotate_msa.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/rotate_neon64.cc -o source/rotate_neon64.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/rotate_neon.cc -o source/rotate_neon.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/rotate_win.cc -o source/rotate_win.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/row_any.cc -o source/row_any.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/row_common.cc -o source/row_common.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/row_gcc.cc -o source/row_gcc.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/row_mmi.cc -o source/row_mmi.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/row_msa.cc -o source/row_msa.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/row_neon64.cc -o source/row_neon64.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/row_neon.cc -o source/row_neon.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/row_win.cc -o source/row_win.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/scale_any.cc -o source/scale_any.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/scale_argb.cc -o source/scale_argb.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/scale.cc -o source/scale.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/scale_common.cc -o source/scale_common.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/scale_gcc.cc -o source/scale_gcc.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/scale_mmi.cc -o source/scale_mmi.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/scale_msa.cc -o source/scale_msa.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/scale_neon64.cc -o source/scale_neon64.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/scale_neon.cc -o source/scale_neon.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/scale_win.cc -o source/scale_win.o
clang++ -c -O2 -fomit-frame-pointer -Iinclude/ source/video_common.cc -o source/video_common.o
ar rv libyuv.a source/compare.o source/compare_common.o source/compare_gcc.o source/compare_mmi.o source/compare_msa.o source/compare_neon64.o source/compare_neon.o source/compare_win.o source/convert_argb.o source/convert.o source/convert_from_argb.o source/convert_from.o source/convert_jpeg.o source/convert_to_argb.o source/convert_to_i420.o source/cpu_id.o source/mjpeg_decoder.o source/mjpeg_validate.o source/planar_functions.o source/rotate_any.o source/rotate_argb.o source/rotate.o source/rotate_common.o source/rotate_gcc.o source/rotate_mmi.o source/rotate_msa.o source/rotate_neon64.o source/rotate_neon.o source/rotate_win.o source/row_any.o source/row_common.o source/row_gcc.o source/row_mmi.o source/row_msa.o source/row_neon64.o source/row_neon.o source/row_win.o source/scale_any.o source/scale_argb.o source/scale.o source/scale_common.o source/scale_gcc.o source/scale_mmi.o source/scale_msa.o source/scale_neon64.o source/scale_neon.o source/scale_win.o source/video_common.o
ar: creating libyuv.a
a - source/compare.o
a - source/compare_common.o
a - source/compare_gcc.o
a - source/compare_mmi.o
a - source/compare_msa.o
a - source/compare_neon64.o
a - source/compare_neon.o
a - source/compare_win.o
a - source/convert_argb.o
a - source/convert.o
a - source/convert_from_argb.o
a - source/convert_from.o
a - source/convert_jpeg.o
a - source/convert_to_argb.o
a - source/convert_to_i420.o
a - source/cpu_id.o
a - source/mjpeg_decoder.o
a - source/mjpeg_validate.o
a - source/planar_functions.o
a - source/rotate_any.o
a - source/rotate_argb.o
a - source/rotate.o
a - source/rotate_common.o
a - source/rotate_gcc.o
a - source/rotate_mmi.o
a - source/rotate_msa.o
a - source/rotate_neon64.o
a - source/rotate_neon.o
a - source/rotate_win.o
a - source/row_any.o
a - source/row_common.o
a - source/row_gcc.o
a - source/row_mmi.o
a - source/row_msa.o
a - source/row_neon64.o
a - source/row_neon.o
a - source/row_win.o
a - source/scale_any.o
a - source/scale_argb.o
a - source/scale.o
a - source/scale_common.o
a - source/scale_gcc.o
a - source/scale_mmi.o
a - source/scale_msa.o
a - source/scale_neon64.o
a - source/scale_neon.o
a - source/scale_win.o
a - source/video_common.o
clang++ -O2 -fomit-frame-pointer -Iinclude/ -Iutil/ -o yuvconvert util/yuvconvert.cc libyuv.a

cc -O2 -fomit-frame-pointer -Iinclude/ -o cpuid util/cpuid.c libyuv.a
/usr/bin/ld: libyuv.a(cpu_id.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output

collect2: error: ld returned 1 exit status
linux.mk:85: recipe for target 'cpuid' failed
make: *** [cpuid] Error 1

Frank Barchard

unread,
Apr 20, 2020, 10:38:09 PM4/20/20
to discuss...@googlegroups.com
On Mon, Apr 20, 2020 at 4:00 PM Yaroslav Taran <yar....@gmail.com> wrote:
When I run this command:
make V=1 -f linux.mk CXX=clang++

CXX is the C++ compiler.  the cpuid example purposely tests the C compiler.
make V=1 -f linux.mk CXX=clang++ CC=clang

or if you only want the library c++ is enough:

make V=1 -f linux.mk CXX=clang++ libyuv.a

 

Yaroslav Taran

unread,
Apr 21, 2020, 9:35:47 AM4/21/20
to discuss...@googlegroups.com
Hi Frank,
I download eclipse, run the project and configure everything properly.
The linker cannot find the library.
I am really stacked..
I added everything properly in Paths and Symbols. Why linker fails ?????

image.png

image.png


Building target: helloc_plus_plus.elf
Invoking: GCC C++ Linker
g++  -L/home/alex-linux/libyuv/libyuv -o "helloc_plus_plus.elf"  ./VidFile/VideoOpener.o ./VidFile/svsLinux.o ./VidFile/vidFileEx.o ./VidFile/vid_save_bmp.o  ./MECL/model/ViewGen_Hydra2.o  ./MECL/core/MatCalcIndex.o ./MECL/core/MeclAssert.o ./MECL/core/MeclLogging.o  ./main.o   -l/home/alex-linux/libyuv/libyuv/libyuv.a
/usr/bin/ld: cannot find -l/home/alex-linux/libyuv/libyuv/libyuv.a

makefile:47: recipe for target 'helloc_plus_plus.elf' failed
collect2: error: ld returned 1 exit status
make: *** [helloc_plus_plus.elf] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

09:28:06 Build Failed. 3 errors, 21 warnings. (took 1s.818ms)

Frank Barchard

unread,
Apr 21, 2020, 1:16:45 PM4/21/20
to discuss...@googlegroups.com
I dont know eclipse, but can take some guesses
I assume your intent was the library has been built with make and is in the file:
/home/alex-linux/libyuv/libyuv/libyuv.a
First check that the library exists in that location.

You said the library location is in this folder:
-L/home/alex-linux/libyuv/libyuv 
which looks right

But the library name looks wrong
 -l/home/alex-linux/libyuv/libyuv/libyuv.a
If you use -l it puts lib and .a around the name.  So it looks for 
lib/home/alex-linux/libyuv/libyuv/libyuv.a.a
in the directory /home/alex-linux/libyuv/libyuv, so it looks for
/home/alex-linux/libyuv/libyuv/lib/home/alex-linux/libyuv/libyuv/libyuv.a.a
Try library name:
yuv



Yaroslav Taran

unread,
Apr 22, 2020, 9:24:17 AM4/22/20
to discuss...@googlegroups.com
I configured properly.
libyuv library still doesn't work.
The same error.


Frank Barchard

unread,
Apr 22, 2020, 4:22:30 PM4/22/20
to discuss...@googlegroups.com
On Wed, Apr 22, 2020 at 6:24 AM Yaroslav Taran <yar....@gmail.com> wrote:
I configured properly.
libyuv library still doesn't work.
The same error.

The error youre getting is a file not found
/usr/bin/ld: cannot find -l/home/alex-linux/libyuv/libyuv/libyuv.a

You used g++ to link
g++  -L/home/alex-linux/libyuv/libyuv -o "helloc_plus_plus.elf"  ./VidFile/VideoOpener.o ./VidFile/svsLinux.o ./VidFile/vidFileEx.o ./VidFile/vid_save_bmp.o  ./MECL/model/ViewGen_Hydra2.o  ./MECL/core/MatCalcIndex.o ./MECL/core/MeclAssert.o ./MECL/core/MeclLogging.o  ./main.o   -l/home/alex-linux/libyuv/libyuv/libyuv.a

To reproduce your error first I used g++
make -f linux.mk cpuid CC=gcc CXX=g++

The taking the simplest example, cpuid, I made a c++ version of it
g++ -Iinclude/ -o cpuid util/cpuid.cc libyuv.a

The basic make file still works with that
If I change the link to use -l like your build
g++ -Iinclude/ -o cpuid util/cpuid.cc -llibyuv.a
/usr/bin/ld: cannot find -llibyuv.a
collect2: error: ld returned 1 exit status

If I tell it the directory with -L and specify -l with lib and .a removed this works:
g++ -Iinclude/ -o cpuid util/cpuid.cc -L. -lyuv

and it runs
./cpuid
Cpu Vendor: GenuineIntel
Cpu Family 6 (0x6), Model 85 (0x55)
Cpu Flags 1bff1
Has ARM 0
Has MIPS 0
Has X86 10
Has SSE2 20

If you can't get it working as a library, you can compile the source code into your project.
Depending on the platform(s) you're targetting, you may need compile options to enable AVX or Neon

I'll make a change to cpuid to make it C++ I renamed it to util/cpuid.cc and added
using namespace libyuv;
I'll check the change for namespace.

Yaroslav Taran

unread,
Apr 27, 2020, 5:26:26 PM4/27/20
to discuss...@googlegroups.com
I compiled it but now I don't have a reference to the function:

building target: Libyuv_getImage
Invoking: GCC C++ Linker
g++ -L"/home/alex-linux/TI/helloc_plus_plus_old_apr21/lib" -o "Libyuv_getImage"  ./VidFile/VideoOpener.o ./VidFile/svsLinux.o ./VidFile/vidFileEx.o ./VidFile/vid_save_bmp.o  ./MECL/model/ViewGen_Hydra2.o  ./MECL/core/MatCalcIndex.o ./MECL/core/MeclAssert.o ./MECL/core/MeclLogging.o  ./main.o   -lyuv
./main.o: In function `main':
/home/alex-linux/TI/helloc_plus_plus_old_apr21/Debug/../main.cpp:70: undefined reference to `I444ToNV12(unsigned char const*, int, unsigned char const*, int, unsigned char const*, int, unsigned char*, int, unsigned char*, int, int, int)'

collect2: error: ld returned 1 exit status
makefile:47: recipe for target 'Libyuv_getImage' failed
make: *** [Libyuv_getImage] Error 1

"make all" terminated with exit code 2. Build might be incomplete.

May be I don't call it right? 

 unsigned char *InputImagePtr = vidOpener.GetAttrBuf( m_processedFrameNum, "");
unsigned char NV12ImagePtr[(640*400) + (640*400/4) + (640*400/4)];


I444ToNV12(InputImagePtr,                     //uint8_t* src_y
              640,                               //int src_stride_y,
              (InputImagePtr + 640*400),           // const uint8_t* src_u,
              640,                               //int src_stride_u,
              (InputImagePtr + 640*400 + 640*400), //const uint8_t* src_v,
              640,                               //int src_stride_v,
  NV12ImagePtr,                      //uint8_t* dst_y,
              640,                               //int dst_stride_y,
  (NV12ImagePtr +640*400),             //uint8_t* dst_uv,
              640,                               //int dst_stride_uv,
              640,               //int width,
              400                //int height
  );

What is wrong ?

Frank Barchard

unread,
Apr 27, 2020, 8:38:03 PM4/27/20
to discuss...@googlegroups.com
missing namespace?

libyuv::I444ToNV12(InputImagePtr,


Yaroslav Taran

unread,
Apr 27, 2020, 9:26:52 PM4/27/20
to discuss...@googlegroups.com
Thank you,
I added namespace, and now get this error (I added fPIC in compilation, still get the same errors).

Building target: Libyuv_getImage

Invoking: GCC C++ Linker
g++ -L"/home/alex-linux/TI/helloc_plus_plus_old_apr21/lib" -o "Libyuv_getImage"  ./VidFile/VideoOpener.o ./VidFile/svsLinux.o ./VidFile/vidFileEx.o ./VidFile/vid_save_bmp.o  ./MECL/model/ViewGen_Hydra2.o  ./MECL/core/MatCalcIndex.o ./MECL/core/MeclAssert.o ./MECL/core/MeclLogging.o  ./main.o   -lyuv
/usr/bin/ld: /home/alex-linux/TI/helloc_plus_plus_old_apr21/lib/libyuv.a(convert.o): relocation R_X86_64_32 against symbol `CopyRow_C' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/alex-linux/TI/helloc_plus_plus_old_apr21/lib/libyuv.a(cpu_id.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/alex-linux/TI/helloc_plus_plus_old_apr21/lib/libyuv.a(planar_functions.o): relocation R_X86_64_32 against symbol `CopyRow_C' can not be used when making a PIE object; recompile with -fPIC

makefile:47: recipe for target 'Libyuv_getImage' failed
/usr/bin/ld: /home/alex-linux/TI/helloc_plus_plus_old_apr21/lib/libyuv.a(row_common.o): relocation R_X86_64_32S against `.rodata.cst16' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/alex-linux/TI/helloc_plus_plus_old_apr21/lib/libyuv.a(row_gcc.o): relocation R_X86_64_32 against symbol `fixed_invtbl8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/alex-linux/TI/helloc_plus_plus_old_apr21/lib/libyuv.a(scale.o): relocation R_X86_64_32 against symbol `ScaleFilterCols64_C' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/alex-linux/TI/helloc_plus_plus_old_apr21/lib/libyuv.a(scale_common.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC

/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make: *** [Libyuv_getImage] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

Thanks,
Slava


Frank Barchard

unread,
Apr 27, 2020, 9:41:49 PM4/27/20
to discuss...@googlegroups.com
On Mon, Apr 27, 2020 at 6:26 PM Yaroslav Taran <yar....@gmail.com> wrote:
Thank you,
I added namespace, and now get this error (I added fPIC in compilation, still get the same errors).

Try
CFLAGS=-fPIC CXXFLAGS=-fPIC make -f linux.mk all

 

Yaroslav Taran

unread,
Apr 28, 2020, 10:42:11 AM4/28/20
to discuss...@googlegroups.com
Thank you so much!
It works now!
And converts images extremely fast.
Appreciate your help a lot!

Slava

Yaroslav Taran

unread,
May 4, 2020, 6:15:12 PM5/4/20
to discuss...@googlegroups.com
I would like to build libyuv.a using A72 compiler (Cortex-A72).
What files / folders do i need to take from libyuv folder ?
Could you please send me instructions how to compile and build it ?

Thanks,
Slava


Frank Barchard

unread,
May 4, 2020, 6:31:57 PM5/4/20
to discuss...@googlegroups.com
On Mon, May 4, 2020 at 3:15 PM Yaroslav Taran <yar....@gmail.com> wrote:
I would like to build libyuv.a using A72 compiler (Cortex-A72).

A72 is a 64 bit arm cpu.  Like intel, you'll need to decide if you're supporting 32 bit or 64 bit.  64 bit is preferred.
But it depends on the OS / device.
The most common compiler for ARM is clang.
 
What files / folders do i need to take from libyuv folder ?

source/*
include/libyuv/*

You can build all files in the source/* folder
If you want to prune it down, if you aiming for 64 bit arm, you'll need *neon64.cc but not *neon.cc
You can omit *msa.cc *mmi.cc *gcc.cc *win.cc
 
Could you please send me instructions how to compile and build it ?

chromium build system is the officially supported way to build.   see also:

 
Reply all
Reply to author
Forward
0 new messages