$ gst-launch-1.0 -vvvv v4l2src ! videoscale ! video/x-raw, format=I420, width=1280, height=720, framerate=30/1 ! imxvpuenc_h264 bitrate=10000 ! filesink location=/tmp/720.mp4 
New clock: GstSystemClock

/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
[INFO]  ringBufferEnable 0, chromaInterleave 0, mapType 0, linear2TiledEnable 1
/GstPipeline:pipeline0/GstImxVpuEncoderH264:imxvpuencoderh264-0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstImxVpuEncoderH264:imxvpuencoderh264-0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, parsed=(boolean)true, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, parsed=(boolean)true, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2

 

$ gst-launch-1.0 -vvvv v4l2src ! videoscale ! video/x-raw, format=I420, width=800, height=480, framerate=15/1 ! imxvpuenc_h264 bitrate=10000 ! filesink location=/tmp/480.mp4 
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)800, height=(int)480, framerate=(fraction)15/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)800, height=(int)480, framerate=(fraction)15/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)800, height=(int)480, framerate=(fraction)15/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
[INFO]  ringBufferEnable 0, chromaInterleave 0, mapType 0, linear2TiledEnable 1
/GstPipeline:pipeline0/GstImxVpuEncoderH264:imxvpuencoderh264-0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)800, height=(int)480, framerate=(fraction)15/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)800, height=(int)480, framerate=(fraction)15/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)800, height=(int)480, framerate=(fraction)15/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstImxVpuEncoderH264:imxvpuencoderh264-0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, parsed=(boolean)true, width=(int)800, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)15/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, chroma-site=(string)jpeg
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, parsed=(boolean)true, width=(int)800, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)15/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, chroma-site=(string)jpeg

[링크 : https://community.nxp.com/t5/i-MX-Processors/Encode-problem-with-imxvpuenc-h264/m-p/513557]

'프로그램 사용 > gstreamer' 카테고리의 다른 글

gstream videomixer  (0) 2023.02.17
gstream compositing - 그러니까 비디오 믹서?  (0) 2021.07.21
gstreamer 관련  (0) 2021.07.13
gstreamer 용어  (0) 2021.07.13
gstreamer element 생성 gst_element_factory_make()  (0) 2021.07.13
Posted by 구차니

MAN page 발췌

NAME
       gst-launch-1.0 - build and run a GStreamer pipeline

SYNOPSIS
       gst-launch-1.0 [OPTION...] PIPELINE-DESCRIPTION

DESCRIPTION
       gst-launch-1.0 is a tool that builds and runs basic GStreamer pipelines.

       In simple form, a PIPELINE-DESCRIPTION is a list of elements separated by exclamation marks (!). Properties may be appended to elements, in the form property=value.

       For a complete description of possible PIPELINE-DESCRIPTIONS see the section pipeline description below or consult the GStreamer documentation.

       Please  note  that gst-launch-1.0 is primarily a debugging tool for developers and users. You should not build applications on top of it. For applications, use the gst_parse_launch() function of the GStreamer API as an easy way to construct pipe‐
       lines from pipeline descriptions.

PIPELINE DESCRIPTION
       A pipeline consists elements and links. Elements can be put into bins of different sorts. Elements, links and bins can be specified in a pipeline description in any order.

       Elements

       ELEMENTTYPE [PROPERTY1 ...]

       Creates an element of type ELEMENTTYPE and sets the PROPERTIES.

       Properties

       PROPERTY=VALUE ...

       Sets the property to the specified value. You can use gst-inspect-1.0(1) to find out about properties and allowed values of different elements.
       Enumeration properties can be set by name, nick or value.

       Bins

       [BINTYPE.] ( [PROPERTY1 ...] PIPELINE-DESCRIPTION )

       Specifies that a bin of type BINTYPE is created and the given properties are set. Every element between the braces is put into the bin. Please note the dot that has to be used after the BINTYPE. You will almost never need this  functionality,  it
       is only really useful for applications using the gst_launch_parse() API with 'bin' as bintype. That way it is possible to build partial pipelines instead of a full-fledged top-level pipeline.

       Links

       [[SRCELEMENT].[PAD1,...]] ! [[SINKELEMENT].[PAD1,...]]  [[SRCELEMENT].[PAD1,...]] ! CAPS ! [[SINKELEMENT].[PAD1,...]]  [[SRCELEMENT].[PAD1,...]] : [[SINKELEMENT].[PAD1,...]]  [[SRCELEMENT].[PAD1,...]] : CAPS : [[SINKELEMENT].[PAD1,...]]

       Links  the  element  with name SRCELEMENT to the element with name SINKELEMENT, using the caps specified in CAPS as a filter.  Names can be set on elements with the name property. If the name is omitted, the element that was specified directly in
       front of or after the link is used. This works across bins. If a padname is given, the link is done with these pads. If no pad names are given all possibilities are tried and a matching pad is used.  If multiple padnames  are  given,  both  sides
       must have the same number of pads specified and multiple links are done in the given order.
       So the simplest link is a simple exclamation mark, that links the element to the left of it to the element right of it.
       Linking using the : operator attempts to link all possible pads between the elements

       Caps

       MEDIATYPE [, PROPERTY[, PROPERTY ...]]] [; CAPS[; CAPS ...]]

       Creates a capability with the given media type and optionally with given properties. The media type can be escaped using " or '.  If you want to chain caps, you can add more caps in the same format afterwards.

       Properties

       NAME=[(TYPE)]VALUE
       in lists and ranges: [(TYPE)]VALUE

       Sets the requested property in capabilities. The name is an alphanumeric value and the type can have the following case-insensitive values:
       - i or int for integer values or ranges
       - f or float for float values or ranges
       - b, bool or boolean for boolean values
       - s, str or string for strings
       - fraction for fractions (framerate, pixel-aspect-ratio)
       - l or list for lists
       If no type was given, the following order is tried: integer, float, boolean, string.
       Integer values must be parsable by strtol(), floats by strtod(). FOURCC values may either be integers or strings. Boolean values are (case insensitive) yes, no, true or false and may like strings be escaped with " or '.
       Ranges are in this format:  [ VALUE, VALUE ]
       Lists use this format:      { VALUE [, VALUE ...] }

PIPELINE EXAMPLES
       The  examples  below  assume  that  you have the correct plug-ins available.  In general, "pulsesink" can be substituted with another audio output plug-in such as "alsasink" or "osxaudiosink" Likewise, "xvimagesink" can be substituted with "xima‐
       gesink", "glimagesink", or "osxvideosink". Keep in mind though that different sinks might accept different formats and even the same sink might accept different formats on different machines, so you might  need  to  add  converter  elements  like
       audioconvert and audioresample (for audio) or videoconvert (for video) in front of the sink to make things work.

       Audio playback

       Play the mp3 music file "music.mp3" using a libmpg123-based plug-in and output to an Pulseaudio device
               gst-launch-1.0 filesrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! pulsesink

       Play an Ogg Vorbis format file
               gst-launch-1.0 filesrc location=music.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! pulsesink

       Play an mp3 file or an http stream using GIO
               gst-launch-1.0 giosrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! pulsesink
               gst-launch-1.0 giosrc location=http://domain.com/music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! pulsesink

       Use GIO to play an mp3 file located on an SMB server
               gst-launch-1.0 giosrc location=smb://computer/music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! pulsesink

       Format conversion

       Convert an mp3 music file to an Ogg Vorbis file
               gst-launch-1.0 filesrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! vorbisenc ! oggmux ! filesink location=music.ogg

       Convert to the FLAC format
               gst-launch-1.0 filesrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! flacenc ! filesink location=test.flac

[링크 : https://linux.die.net/man/1/gst-launch-0.10]

'프로그램 사용 > gstreamer' 카테고리의 다른 글

gst h264 filesink  (0) 2021.07.14
gstreamer 관련  (0) 2021.07.13
gstreamer element 생성 gst_element_factory_make()  (0) 2021.07.13
gst fpsdisplaysink  (0) 2021.02.18
gst videorate  (0) 2021.02.09
Posted by 구차니

'프로그램 사용 > gstreamer' 카테고리의 다른 글

gstreamer 관련  (0) 2021.07.13
gstreamer 용어  (0) 2021.07.13
gst fpsdisplaysink  (0) 2021.02.18
gst videorate  (0) 2021.02.09
gstreamer tee  (0) 2021.02.08
Posted by 구차니
프로그램 사용/gcc2021. 7. 8. 10:40

귀찮으니 날로먹는 코딩으로 테스트

$ cat 1.c
#include <stdio.h>

void main()
{
        unsigned char a = 0xFF;
        char b =a;
        short c = a;
        short d = (char)a;
        short e = (int)a;

        int f = a;
        int g = (int)a;
        int h = (int)(char)a;

        printf("a %d\n",a);
        printf("a %d\n",(int)a);
        printf("a %d\n",(char)a);
        printf("b %d\n",b);
        printf("c %d\n",c);
        printf("d %d\n",d);
        printf("e %d\n",e);
        printf("f %d\n",f);
        printf("g %d\n",g);
        printf("h %d\n",h);
}

 

컴파일러 버전과 아키텍쳐, 그리고 결과인데... 머냐..?!?!

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabihf/7/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-multilib --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include
Thread model: posix
gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
$ ./1
a 255
a 255
a -1
b -1
c 255
d -1
e 255
f 255
g 255
h -1
# /mnt/1
a 255
a 255
a 255
b 255
c 255
d 255
e 255
f 255
g 255

 

라즈베리 파이 4에서 시도. arm 아키텍쳐용 컴파일러의 특성인가?

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/8/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --disable-libphobos --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-6)
$ ./1
a 255
a 255
a 255
b 255
c 255
d 255
e 255
f 255
g 255
h 255

 

+

두개중에 하나만 주면 되는진 모르겠지만, 둘 다 주거나 -fsigned-char 만 주어도 결과가 -1로 나오긴 한다.

원문으로 보니 --signed-chars는 RVCT 컴파일러를 위한 옵션인 듯.

The ANSI C standard specifies a range for both signed (at least -127 to +127) and unsigned (at least 0 to 255) chars. Simple chars are not specifically defined and it is compiler dependent whether they are signed or unsigned. Although the ARM architecture has the LDRSB instruction, that loads a signed byte into a 32-bit register with sign extension, the earliest versions of the architecture did not. It made sense at the time for the compiler to treat simple chars as unsigned, whereas on the x86 simple chars are, by default, treated as signed.
One workaround for users of GCC is to use the -fsigned-char command line switch or --signed-chars for RVCT, that forces all chars to become signed, but a better practice is to write portable code by declaring char variables appropriately. Unsigned char must be used for accessing memory as a block of bytes or for small unsigned integers. Signed char must be used for small signed integers and simple char must be used only for ASCII characters and strings. In fact, on an ARM core, it is usually better to use ints rather than chars, even for small values, for performance reasons. You can read more on this in Optimizing Code to Run on ARM Processors.

[링크 : https://developer.arm.com/.../Miscellaneous-C-porting-issues/unsigned-char-and-signed-char]

 

LDRSB (Thumb*) - Load Register Signed Byte

[링크 : http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/LDRSB_(Thumb).htm]

 

LDRB - Load Register Byte

[링크 : http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/INST_LDRB.htm]

 

char -> signed char: -fsigned-char == -fno-unsigned-char
char -> unsigned char: -funsigned-char == -fno-signed-char

[링크 : https://jooojub.github.io/gcc-options-fsigned-char/]

 

-fsigned-char
Let the type char be signed, like signed char.
Note that this is equivalent to -fno-unsigned-char, which is the negative form of -funsigned-char. Likewise, the option -fno-signed-char is equivalent to -funsigned-char.

-funsigned-char
Let the type char be unsigned, like unsigned char.
Each kind of machine has a default for what char should be. It is either like unsigned char by default or like signed char by default.
Ideally, a portable program should always use signed char or unsigned char when it depends on the signedness of an object. But many programs have been written to use plain char and expect it to be signed, or expect it to be unsigned, depending on the machines they were written for. This option, and its inverse, let you make such a program work with the opposite default.
The type char is always a distinct type from each of signed char or unsigned char, even though its behavior is always just like one of those two.

[링크 : https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html]

 

+

2021.07.09

으잉? singed char로 하면 되긴 한다. char가 signed 아니었어?!

'프로그램 사용 > gcc' 카테고리의 다른 글

static link  (0) 2022.02.07
구조체 타입과 변수명은 구분된다?  (0) 2021.11.18
gcc vectorized loop  (0) 2021.06.30
gcc unsigned to signed cast  (0) 2021.06.22
gcc %p (nil)  (0) 2021.05.07
Posted by 구차니
프로그램 사용/sdl2021. 7. 6. 12:08

게임에서도 쓰이긴 한데 일반 MFC를 대체하는 용도로 쓰려면 어딜 봐야하나... ㅠㅠ

 

[링크 : https://www.libsdl.org/]

[링크 : https://wiki.libsdl.org/]

 

SDL 2.0은 zlib 라이선스

SDL 1.2 이전은 GNU LGPL 라이선스를 따름.

[링크 : https://www.libsdl.org/license.php]

'프로그램 사용 > sdl' 카테고리의 다른 글

sdl tutorial  (0) 2022.05.27
libsdl + mfc  (0) 2017.02.09
SDL - Simple DirectMedia Layer  (0) 2011.12.12
Posted by 구차니

아따 빡세다 -_-

 

컴파일 하는데 libz.so.1이 없다고 하는데

아마도.. 64bit ubuntu라 32bit 용 libz가 없다고 배쨰는 듯

/home/minimonk/work/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../libexec/gcc/arm-linux-gnueabihf/4.8.3/cc1plus: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory

$sudo apt-get install lib32z1

[링크 : https://damedame.tistory.com/entry/libzso1-파일을-찾을수-없을때]

 

std::is_trivially_copyable은 c++11 표준이라 gcc 5.x 이상부터 지원하기 때문이라고

In file included from /home/minimonk/work/tensorflow/tensorflow/lite/tools/make/downloads/ruy/ruy/frontend.h:30:0,
                 from /home/minimonk/work/tensorflow/tensorflow/lite/tools/make/downloads/ruy/ruy/ruy.h:23,
                 from ./tensorflow/lite/kernels/cpu_backend_gemm_ruy.h:21,
                 from ./tensorflow/lite/kernels/cpu_backend_gemm.h:25,
                 from ./tensorflow/lite/kernels/internal/optimized/optimized_ops.h:45,
                 from tensorflow/lite/kernels/audio_spectrogram.cc:24:
/home/minimonk/work/tensorflow/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h: In function ‘void ruy::detail::FinalizeMulParams(const ruy::MulParams<AccumScalar, DstScalar>&, ruy::ChannelDimension, ruy::Ctx*, ruy::TrMulParams*)’:
/home/minimonk/work/tensorflow/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h:388:17: error: ‘is_trivially_copyable’ is not a member of ‘std’
   static_assert(std::is_trivially_copyable<MulParamsType>::value, "");
                 ^
/home/minimonk/work/tensorflow/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h:388:57: error: expected primary-expression before ‘>’ token
   static_assert(std::is_trivially_copyable<MulParamsType>::value, "");
                                                         ^
/home/minimonk/work/tensorflow/tensorflow/lite/tools/make/downloads/ruy/ruy/create_trmul_params.h:388:58: error: ‘::value’ has not been declared
   static_assert(std::is_trivially_copyable<MulParamsType>::value, "");
                                                          ^

[링크 : https://stackoverflow.com/questions/25123458/is-trivially-copyable-is-not-a-member-of-std]

 

예라이... -_-

$ arm-linux-gnueabihf-g++ --version
arm-linux-gnueabihf-g++ (crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11) 4.8.3 20140106 (prerelease)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

$ sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf

[링크 : https://blog.thinkbee.kr/linux/crosscompile-arm/]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tflite gpu openCL support build fail  (0) 2021.08.31
tf lite cmake  (0) 2021.08.27
tensorflow lite on rpi4 64bit  (0) 2021.06.30
tensorflow delegate  (0) 2021.06.30
tflite typed_tensor(), tensor()  (0) 2021.06.25
Posted by 구차니

build_rpi_lib.sh를 통해 빌드 하려는데 에러 뿜뿜 -_-

그래서 makefile을 고쳐야 하나 멘붕이 와서 다시 찾아 보는데

/bin/bash: arm-linux-gnueabihf-g++: command not found

 

./tensorflow/lite/tools/make/build_aarch64_lib.sh

[링크 : https://www.tensorflow.org/lite/guide/build_arm64?hl=ko]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tf lite cmake  (0) 2021.08.27
tensorflow cross compile  (0) 2021.07.01
tensorflow delegate  (0) 2021.06.30
tflite typed_tensor(), tensor()  (0) 2021.06.25
tflite yolov4  (0) 2021.06.14
Posted by 구차니

전에 찾아볼때 대리자 이런게 있길래 그냥 넘겼는데

그래프 실행의 "일부" 또는 "전체"를 다른 실행자에게 넘기는 방법

오.. 그러면 전체 연산중에 일부만을 넘길수 있다면.. delegate를 이용해 분산 처리도 가능할지도?

 

TensorFlow Lite 대리자는 그래프 실행의 일부 또는 전체를 다른 executor에 위임하는 방법입니다.

 

NPU도 지원이 가능하다는데

  • 최신 Android 기기용 NNAPI 대리자 - NNAPI 대리자를 사용하여 GPU, DSP 및/또는 NPU를 사용할 수 있는 Android 기기에서 모델을 가속화할 수 있습니다. Android 8.1(API 27+) 이상에서 사용할 수 있습니다. NNAPI 대리자 개요, 단계별 지침 및 모범 사례는 TensorFlow Lite NNAPI 대리자를 참조하세요.

[링크 : https://www.tensorflow.org/lite/performance/delegates?hl=ko]

 

cpp 로는 안되나.. android 8.1 이상 기기에서 쓸 수 있다고만 나오네

Android Neural Networks API(NNAPI)는 Android 8.1(API 레벨 27) 이상을 실행하는 모든 Android 기기에서 사용할 수 있습니다. 다음과 같은 하드웨어 가속기를 지원하는 Android 기기의 TensorFlow Lite 모델을 속도를 향상합니다.
  • 그래픽 처리 장치(GPU)
  • 디지털 신호 프로세서(DSP)
  • 신경 처리 장치(NPU)

[링크 : https://www.tensorflow.org/lite/performance/nnapi?hl=ko]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tensorflow cross compile  (0) 2021.07.01
tensorflow lite on rpi4 64bit  (0) 2021.06.30
tflite typed_tensor(), tensor()  (0) 2021.06.25
tflite yolov4  (0) 2021.06.14
tensorflow lite yolov4  (0) 2021.06.10
Posted by 구차니
프로그램 사용/gcc2021. 6. 30. 11:43

-O3 하면 자동으로 -ftree-vectorize가 추가되었다고.

아무튼 연산만 하고 출력을 안하니 사용하지 않는 코드로 해서 vadd가 안나와서 한참을 헤맸네..

 

$ g++ -O3 -mavx autovector.cpp -fopt-info-vec-all
autovector.cpp:22:22: missed: couldn't vectorize loop
autovector.cpp:25:19: missed: not vectorized: complicated access pattern.
autovector.cpp:23:21: missed: couldn't vectorize loop
autovector.cpp:25:14: missed: not vectorized: complicated access pattern.
autovector.cpp:16:23: optimized: loop vectorized using 32 byte vectors
autovector.cpp:10:5: note: vectorized 1 loops in function.
autovector.cpp:15:43: missed: statement clobbers memory: now = std::chrono::_V2::system_clock::now ();
autovector.cpp:27:77: missed: statement clobbers memory: D.189348 = std::chrono::_V2::system_clock::now ();
autovector.cpp:28:2: missed: statement clobbers memory: __assert_fail ("result[2] == ( 2.0f + 0.1335f)+( 1.50f*2.0f + 0.9383f)-(0.33f*2.0f+0.1172f)+3*(float)(noTests-1)", "autovector.cpp", 28, "int main()");
/usr/include/c++/9/ostream:570:18: missed: statement clobbers memory: std::__ostream_insert<char, std::char_traits<char> > (&cout, "CG> message -channel \"exercise results\" Time used: ", 51);
/usr/include/c++/9/ostream:221:29: missed: statement clobbers memory: _46 = std::basic_ostream<char>::_M_insert<double> (&cout, _42);
/usr/include/c++/9/ostream:570:18: missed: statement clobbers memory: std::__ostream_insert<char, std::char_traits<char> > (_46, "s, N * noTests=", 15);
autovector.cpp:29:112: missed: statement clobbers memory: _35 = std::basic_ostream<char>::operator<< (_46, 2000000000);
/usr/include/c++/9/ostream:113:13: missed: statement clobbers memory: std::endl<char, std::char_traits<char> > (_35);
/usr/include/c++/9/iostream:74:25: missed: statement clobbers memory: std::ios_base::Init::Init (&__ioinit);
/usr/include/c++/9/iostream:74:25: missed: statement clobbers memory: __cxa_atexit (__dt_comp , &__ioinit, &__dso_handle);
$ gcc -mcpu=native -march=native -Q --help=target
The following options are target specific:
  -mabi=                                aapcs-linux
  -mabort-on-noreturn                   [disabled]
  -mandroid                             [disabled]
  -mapcs                                [disabled]
  -mapcs-frame                          [disabled]
  -mapcs-reentrant                      [disabled]
  -mapcs-stack-check                    [disabled]
  -march=                               armv7ve+vfpv3-d16
  -marm                                 [enabled]
  -masm-syntax-unified                  [disabled]
  -mbe32                                [enabled]
  -mbe8                                 [disabled]
  -mbig-endian                          [disabled]
  -mbionic                              [disabled]
  -mbranch-cost=                        -1
  -mcallee-super-interworking           [disabled]
  -mcaller-super-interworking           [disabled]
  -mcmse                                [disabled]
  -mcpu=                                cortex-a7
  -mfix-cortex-m3-ldrd                  [disabled]
  -mflip-thumb                          [disabled]
  -mfloat-abi=                          hard
  -mfp16-format=                        none
  -mfpu=                                vfp
  -mglibc                               [enabled]
  -mhard-float
  -mlittle-endian                       [enabled]
  -mlong-calls                          [disabled]
  -mmusl                                [disabled]
  -mneon-for-64bits                     [disabled]
  -mpic-data-is-text-relative           [enabled]
  -mpic-register=
  -mpoke-function-name                  [disabled]
  -mprint-tune-info                     [disabled]
  -mpure-code                           [disabled]
  -mrestrict-it                         [disabled]
  -msched-prolog                        [enabled]
  -msingle-pic-base                     [disabled]
  -mslow-flash-data                     [disabled]
  -msoft-float
  -mstructure-size-boundary=            8
  -mthumb                               [disabled]
  -mthumb-interwork                     [disabled]
  -mtls-dialect=                        gnu
  -mtp=                                 cp15
  -mtpcs-frame                          [disabled]
  -mtpcs-leaf-frame                     [disabled]
  -mtune=
  -muclibc                              [disabled]
  -munaligned-access                    [enabled]
  -mvectorize-with-neon-double          [disabled]
  -mvectorize-with-neon-quad            [enabled]
  -mword-relocations                    [disabled]

  Known ARM ABIs (for use with the -mabi= option):
    aapcs aapcs-linux apcs-gnu atpcs iwmmxt

  Known __fp16 formats (for use with the -mfp16-format= option):
    alternative ieee none

  Known ARM FPUs (for use with the -mfpu= option):
    auto crypto-neon-fp-armv8 fp-armv8 fpv4-sp-d16 fpv5-d16 fpv5-sp-d16 neon neon-fp-armv8 neon-fp16 neon-vfpv3 neon-vfpv4 vfp vfp3 vfpv2 vfpv3 vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd
    vfpv3xd-fp16 vfpv4 vfpv4-d16

  Valid arguments to -mtp=:
    auto cp15 soft

  Known floating-point ABIs (for use with the -mfloat-abi= option):
    hard soft softfp

  TLS dialect to use:
    gnu gnu2


[링크 : https://www.raspberrypi.org/forums/viewtopic.php?t=155461]

[링크 : https://www.codingame.com/playgrounds/283/sse-avx-vectorization/autovectorization]

 

+

$ cat neon.c
#include <stdio.h>

void main()
{
        int a[256];
        int b[256];
        int c[256];

        int i;
        for(i = 0; i < 256; i++)
        {
                a[i] = b[i] + c[i];
        }

        printf("%d %d %d\n", a[0], b[0], c[0]);
}

 

$ gcc -O3 neon.c -mfpu=neon
$ objdump -d a.out  | grep v
   10320:       e1a01000        mov     r1, r0
   10328:       e1a0300d        mov     r3, sp
   1032c:       f4610add        vld1.64 {d16-d17}, [r1 :64]!
   10330:       f4622add        vld1.64 {d18-d19}, [r2 :64]!
   10334:       f26008e2        vadd.i32        q8, q8, q9
   10338:       f4430add        vst1.64 {d16-d17}, [r3 :64]!
   10360:       e3a0b000        mov     fp, #0
   10364:       e3a0e000        mov     lr, #0
   1036c:       e1a0200d        mov     r2, sp
   1043c:       e3a03001        mov     r3, #1
   10454:       e1a07000        mov     r7, r0
   1046c:       e1a08001        mov     r8, r1
   10470:       e1a09002        mov     r9, r2
   10480:       e3a04000        mov     r4, #0
   1048c:       e1a02009        mov     r2, r9
   10490:       e1a01008        mov     r1, r8
   10494:       e1a00007        mov     r0, r7

 

$ gcc neon.c -mfpu=neon
$ objdump -d a.out  | grep v
   10318:       e3a0b000        mov     fp, #0
   1031c:       e3a0e000        mov     lr, #0
   10324:       e1a0200d        mov     r2, sp
   103f4:       e3a03001        mov     r3, #1
   10418:       e3a03000        mov     r3, #0
   10490:       e1a00000        nop                     ; (mov r0, r0)
   104a4:       e1a07000        mov     r7, r0
   104bc:       e1a08001        mov     r8, r1
   104c0:       e1a09002        mov     r9, r2
   104d0:       e3a04000        mov     r4, #0
   104dc:       e1a02009        mov     r2, r9
   104e0:       e1a01008        mov     r1, r8
   104e4:       e1a00007        mov     r0, r7

 

-fopt-info-vec-all 추가. -all 때문인지 어마어마하게 나오네

-fopt-info-vec 으로만 하니 깔끔하게 vectorized 라고 뜬다.

$ gcc neon.c -mfpu=neon -fopt-info-vec -O3
neon.c:10:2: note: loop vectorized

'프로그램 사용 > gcc' 카테고리의 다른 글

구조체 타입과 변수명은 구분된다?  (0) 2021.11.18
gcc unsigned to signed upcast 테스트  (0) 2021.07.08
gcc unsigned to signed cast  (0) 2021.06.22
gcc %p (nil)  (0) 2021.05.07
gcc -D 옵션 인자를 printf로 출력하기  (0) 2021.04.08
Posted by 구차니