├── .DS_Store
├── .gitignore
├── LICENSE
├── README.md
├── example
├── .DS_Store
├── android
│ ├── .gitignore
│ ├── .idea
│ │ ├── caches
│ │ │ └── build_file_checksums.ser
│ │ ├── codeStyles
│ │ │ └── Project.xml
│ │ ├── compiler.xml
│ │ ├── gradle.xml
│ │ ├── jarRepositories.xml
│ │ ├── misc.xml
│ │ ├── modules.xml
│ │ └── vcs.xml
│ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── androidTest
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── rex
│ │ │ │ └── gpu
│ │ │ │ └── demo
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── assets
│ │ │ │ ├── filter0.png
│ │ │ │ ├── filter1.png
│ │ │ │ ├── filter10.png
│ │ │ │ ├── filter11.png
│ │ │ │ ├── filter13.png
│ │ │ │ ├── filter15.png
│ │ │ │ ├── filter16.png
│ │ │ │ ├── filter17.png
│ │ │ │ ├── filter18.png
│ │ │ │ ├── filter2.png
│ │ │ │ ├── filter20.png
│ │ │ │ ├── filter21.png
│ │ │ │ ├── filter3.png
│ │ │ │ ├── filter4.png
│ │ │ │ ├── filter5.png
│ │ │ │ ├── filter6.png
│ │ │ │ ├── filter7.png
│ │ │ │ ├── filter8.png
│ │ │ │ ├── filter86.png
│ │ │ │ ├── filter9.png
│ │ │ │ ├── logo.png
│ │ │ │ └── suyan.jpeg
│ │ │ ├── cpp
│ │ │ │ ├── Android.mk
│ │ │ │ ├── Application.mk
│ │ │ │ ├── gpu
│ │ │ │ └── native
│ │ │ │ │ ├── Android.mk
│ │ │ │ │ └── NativeLoad.cpp
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── rex
│ │ │ │ │ ├── gpu
│ │ │ │ │ ├── GPU.java
│ │ │ │ │ ├── GPURawBytesCallback.java
│ │ │ │ │ ├── GPUVideoFrame.java
│ │ │ │ │ └── demo
│ │ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ │ ├── PictureActivity.java
│ │ │ │ │ │ └── TextureActivity.java
│ │ │ │ │ ├── load
│ │ │ │ │ └── NativeLoad.java
│ │ │ │ │ └── utils
│ │ │ │ │ ├── ApkUtil.java
│ │ │ │ │ ├── CameraUtil.java
│ │ │ │ │ ├── DeviceUtil.java
│ │ │ │ │ ├── FileUtil.java
│ │ │ │ │ ├── HttpUtil.java
│ │ │ │ │ ├── LogUtil.java
│ │ │ │ │ └── ManifestUtil.java
│ │ │ └── res
│ │ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ ├── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ │ │ ├── layout
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity_picture.xml
│ │ │ │ └── activity_texture.xml
│ │ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ └── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── rex
│ │ │ └── gpu
│ │ │ └── demo
│ │ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
└── ios
│ ├── .DS_Store
│ ├── ZipArchive
│ ├── .gitignore
│ ├── .travis.yml
│ ├── LICENSE.txt
│ ├── ObjectiveCExample
│ │ ├── ObjectiveCExample.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ ├── ObjectiveCExample_iOS.xcscheme
│ │ │ │ ├── ObjectiveCExample_macOS.xcscheme
│ │ │ │ └── ObjectiveCExample_tvOS.xcscheme
│ │ ├── ObjectiveCExample.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ ├── ObjectiveCExample
│ │ │ ├── AppDelegate.h
│ │ │ ├── AppDelegate.m
│ │ │ ├── Assets.xcassets
│ │ │ │ └── AppIcon.appiconset
│ │ │ │ │ └── Contents.json
│ │ │ ├── Base.lproj
│ │ │ │ ├── LaunchScreen.storyboard
│ │ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ ├── Sample Data
│ │ │ │ ├── 1.md
│ │ │ │ ├── 2.md
│ │ │ │ └── mountain.png
│ │ │ ├── ViewController.h
│ │ │ ├── ViewController.m
│ │ │ └── main.m
│ │ ├── ObjectiveCExampleTests
│ │ │ ├── CancelDelegate.h
│ │ │ ├── CancelDelegate.m
│ │ │ ├── CollectingDelegate.h
│ │ │ ├── CollectingDelegate.m
│ │ │ ├── Fixtures
│ │ │ │ ├── Empty.zip
│ │ │ │ ├── IncorrectHeaders.zip
│ │ │ │ ├── PathTraversal.zip
│ │ │ │ ├── RelativeSymbolicLink.zip
│ │ │ │ ├── SymbolicLink.zip
│ │ │ │ ├── TestArchive.zip
│ │ │ │ ├── TestPasswordArchive.zip
│ │ │ │ ├── Unicode.zip
│ │ │ │ └── hello.zip
│ │ │ ├── Info.plist
│ │ │ ├── Multi_Zip_Test
│ │ │ │ ├── 0.m4a
│ │ │ │ ├── 1.m4a
│ │ │ │ ├── 2.m4a
│ │ │ │ ├── 3.m4a
│ │ │ │ ├── 4.m4a
│ │ │ │ ├── 5.m4a
│ │ │ │ ├── 6.m4a
│ │ │ │ └── 7.m4a
│ │ │ ├── ProgressDelegate.h
│ │ │ ├── ProgressDelegate.m
│ │ │ └── SSZipArchiveTests.m
│ │ ├── Podfile
│ │ └── Podfile.lock
│ ├── README.md
│ ├── Release-Instructions.md
│ ├── SSZipArchive.podspec
│ ├── SSZipArchive
│ │ ├── Info.plist
│ │ ├── SSZipArchive.h
│ │ ├── SSZipArchive.m
│ │ ├── SSZipCommon.h
│ │ ├── ZipArchive.h
│ │ └── minizip
│ │ │ ├── aes
│ │ │ ├── aes.h
│ │ │ ├── aes_ni.c
│ │ │ ├── aes_ni.h
│ │ │ ├── aescrypt.c
│ │ │ ├── aeskey.c
│ │ │ ├── aesopt.h
│ │ │ ├── aestab.c
│ │ │ ├── aestab.h
│ │ │ ├── brg_endian.h
│ │ │ ├── brg_types.h
│ │ │ ├── fileenc.c
│ │ │ ├── fileenc.h
│ │ │ ├── hmac.c
│ │ │ ├── hmac.h
│ │ │ ├── prng.c
│ │ │ ├── prng.h
│ │ │ ├── pwd2key.c
│ │ │ ├── pwd2key.h
│ │ │ ├── sha1.c
│ │ │ └── sha1.h
│ │ │ ├── crypt.c
│ │ │ ├── crypt.h
│ │ │ ├── ioapi.c
│ │ │ ├── ioapi.h
│ │ │ ├── ioapi_buf.c
│ │ │ ├── ioapi_buf.h
│ │ │ ├── ioapi_mem.c
│ │ │ ├── ioapi_mem.h
│ │ │ ├── minishared.c
│ │ │ ├── minishared.h
│ │ │ ├── unzip.c
│ │ │ ├── unzip.h
│ │ │ ├── zip.c
│ │ │ └── zip.h
│ ├── SwiftExample
│ │ ├── Cartfile
│ │ ├── Podfile
│ │ ├── Podfile.lock
│ │ ├── SwiftExample.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ ├── SwiftExample.xcscheme
│ │ │ │ └── SwiftExampleCarthage.xcscheme
│ │ ├── SwiftExample.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ ├── SwiftExample
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Assets.xcassets
│ │ │ │ └── AppIcon.appiconset
│ │ │ │ │ └── Contents.json
│ │ │ ├── Base.lproj
│ │ │ │ ├── LaunchScreen.storyboard
│ │ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ ├── Sample Data
│ │ │ │ ├── 1.md
│ │ │ │ ├── 2.md
│ │ │ │ └── mountain.png
│ │ │ └── ViewController.swift
│ │ └── SwiftExampleTests
│ │ │ ├── Info.plist
│ │ │ └── SwiftExampleTests.swift
│ ├── ZipArchive.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ ├── ZipArchive-Mac.xcscheme
│ │ │ ├── ZipArchive-iOS.xcscheme
│ │ │ ├── ZipArchive-tvos.xcscheme
│ │ │ └── ZipArchive-watchos.xcscheme
│ └── icon.png
│ ├── example.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ ├── Rex.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── Visionin.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ ├── Rex.xcuserdatad
│ │ ├── xcdebugger
│ │ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ │ ├── example.xcscheme
│ │ │ └── xcschememanagement.plist
│ │ └── Visionin.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── example.xcscheme
│ │ └── xcschememanagement.plist
│ └── example
│ ├── .DS_Store
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── GPUVideoCamera.h
│ ├── GPUVideoCamera.m
│ ├── HomeViewController.h
│ ├── HomeViewController.m
│ ├── ImageViewController.h
│ ├── ImageViewController.mm
│ ├── Info.plist
│ ├── PictureViewController.h
│ ├── PictureViewController.mm
│ ├── ViewController.h
│ ├── ViewController.mm
│ ├── facepoints.json
│ ├── filter.zip
│ ├── filter0.png
│ ├── filter1.png
│ ├── filter10.png
│ ├── filter11.png
│ ├── filter13.png
│ ├── filter15.png
│ ├── filter16.png
│ ├── filter17.png
│ ├── filter18.png
│ ├── filter2.png
│ ├── filter20.png
│ ├── filter21.png
│ ├── filter3.png
│ ├── filter4.png
│ ├── filter5.png
│ ├── filter6.png
│ ├── filter7.png
│ ├── filter8.png
│ ├── filter86.png
│ ├── filter9.png
│ ├── logo.png
│ ├── main.m
│ └── suyan.jpeg
└── src
├── .DS_Store
├── Android.mk
├── base
├── .DS_Store
├── Android.mk
├── GL.h
├── GPU.h
├── GPUBlendFilter.cpp
├── GPUBlendFilter.h
├── GPUContext.cpp
├── GPUContext.h
├── GPUFileFilter.cpp
├── GPUFileFilter.h
├── GPUFilter.cpp
├── GPUFilter.h
├── GPUFrameBuffer.cpp
├── GPUFrameBuffer.h
├── GPUGroupFilter.cpp
├── GPUGroupFilter.h
├── GPUInput.cpp
├── GPUInput.h
├── GPULineFilter.cpp
├── GPULineFilter.h
├── GPUOutput.cpp
├── GPUOutput.h
├── GPUOutputFilter.cpp
├── GPUOutputFilter.h
├── GPUPicture.cpp
├── GPUPicture.h
├── GPUPixelBuffer.cpp
├── GPUPixelBuffer.h
├── GPUProgram.cpp
├── GPUProgram.h
├── GPURawGroup.cpp
├── GPURawGroup.h
├── GPURawInput.cpp
├── GPURawInput.h
├── GPURawOutput.cpp
├── GPURawOutput.h
├── GPUTextureInput.cpp
├── GPUTextureInput.h
├── GPUTriangleFilter.h
├── GPUTriangleFilter.h.cpp
├── GPUTwoPassFilter.cpp
├── GPUTwoPassFilter.h
├── GPUVertexBuffer.cpp
├── GPUVertexBuffer.h
├── GPUView.h
├── GPUYUV420Filter.cpp
├── GPUYUV420Filter.h
├── GPUYUVFilter.cpp
├── GPUYUVFilter.h
├── GPUZoomFilter.cpp
├── GPUZoomFilter.h
├── android
│ ├── .DS_Store
│ ├── GPUEglContext.cpp
│ ├── GPUPicture.cpp
│ └── GPUView.cpp
└── ios
│ ├── .DS_Store
│ ├── GPUContext.mm
│ ├── GPUIOSBuffer.h
│ ├── GPUIOSBuffer.mm
│ ├── GPUIOSView.h
│ ├── GPUIOSView.mm
│ ├── GPUPicture.mm
│ ├── GPUSampleBufferInput.h
│ └── GPUSampleBufferInput.mm
├── bs
├── .DS_Store
├── Android.mk
├── Makefile
├── bs.h
├── bs_common.c
├── bs_common.h
├── bs_conf.c
├── bs_conf.h
├── bs_cqueue.c
├── bs_cqueue.h
├── bs_data.c
├── bs_data.h
├── bs_def.h
├── bs_error.h
├── bs_file.c
├── bs_file.h
├── bs_hashmap.c
├── bs_hashmap.h
├── bs_list.c
├── bs_list.h
├── bs_lock.c
├── bs_lock.h
├── bs_log.c
├── bs_log.h
├── bs_macros.h
├── bs_mmap.c
├── bs_mmap.h
├── bs_object.c
├── bs_object.h
├── bs_pack.c
├── bs_pack.h
├── bs_pool.c
├── bs_pool.h
├── bs_sign.c
├── bs_sign.h
├── bs_socket.c
├── bs_socket.h
├── bs_string.c
├── bs_string.h
├── bs_struct.h
├── bs_timer.c
├── bs_timer.h
├── bs_type.h
├── bs_url.c
├── bs_url.h
├── bs_vector.c
├── bs_vector.h
├── ios.mk
├── linux.mk
└── mac.mk
├── filter
├── .DS_Store
├── Android.mk
├── GPUBezierFilter.cpp
├── GPUBezierFilter.h
├── GPUBilateralBlurFilter.cpp
├── GPUBilateralBlurFilter.h
├── GPUBlankFilter.cpp
├── GPUBlankFilter.h
├── GPUBlend2Filter.cpp
├── GPUBlend2Filter.h
├── GPUBlendImageFilter.cpp
├── GPUBlendImageFilter.h
├── GPUColorFilter.cpp
├── GPUColorFilter.h
├── GPUGaussianBlurFilter.cpp
├── GPUGaussianBlurFilter.h
├── GPULookupFilter.cpp
├── GPULookupFilter.h
├── GPULuminanceFilter.cpp
├── GPULuminanceFilter.h
├── GPUMedianFilter.cpp
├── GPUMedianFilter.h
├── GPUOutlineFilter.cpp
├── GPUOutlineFilter.h
├── GPUPaintFilter.cpp
├── GPUPaintFilter.h
├── GPUPixellateFilter.cpp
├── GPUPixellateFilter.h
├── GPUPixellatePositionFilter.cpp
├── GPUPixellatePositionFilter.h
├── GPUSaturationFilter.cpp
├── GPUSaturationFilter.h
├── GPUSmoothFilter.cpp
├── GPUSmoothFilter.h
├── GPUSobelEdgeFilter.cpp
├── GPUSobelEdgeFilter.h
├── GPUWhiteningFilter.cpp
└── GPUWhiteningFilter.h
├── frame
├── .DS_Store
├── Android.mk
├── GPUStreamFrame.cpp
├── GPUStreamFrame.h
├── android
│ ├── .DS_Store
│ └── android_gpu.cpp
└── ios
│ ├── .DS_Store
│ ├── GPUVideoFrame.h
│ └── GPUVideoFrame.mm
├── libGPU.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ ├── Rex.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── Visionin.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── xcuserdata
│ ├── Rex.xcuserdatad
│ └── xcschemes
│ │ ├── libGPU.xcscheme
│ │ └── xcschememanagement.plist
│ └── Visionin.xcuserdatad
│ └── xcschemes
│ ├── libGPU.xcscheme
│ └── xcschememanagement.plist
└── output
├── .DS_Store
└── include
├── .DS_Store
├── GL.h
├── GPU.h
├── GPUBezierFilter.h
├── GPUBilateralBlurFilter.h
├── GPUBlankFilter.h
├── GPUBlend2Filter.h
├── GPUBlendFilter.h
├── GPUBlendImageFilter.h
├── GPUColorFilter.h
├── GPUContext.h
├── GPUFileFilter.h
├── GPUFilter.h
├── GPUFrameBuffer.h
├── GPUGaussianBlurFilter.h
├── GPUGroupFilter.h
├── GPUIOSBuffer.h
├── GPUIOSView.h
├── GPUInput.h
├── GPULineFilter.h
├── GPULookupFilter.h
├── GPULuminanceFilter.h
├── GPUMedianFilter.h
├── GPUOutlineFilter.h
├── GPUOutput.h
├── GPUOutputFilter.h
├── GPUPaintFilter.h
├── GPUPicture.h
├── GPUPixelBuffer.h
├── GPUPixellateFilter.h
├── GPUPixellatePositionFilter.h
├── GPUProgram.h
├── GPURawInput.h
├── GPURawOutput.h
├── GPUSampleBufferInput.h
├── GPUSaturationFilter.h
├── GPUSmoothFilter.h
├── GPUSobelEdgeFilter.h
├── GPUStreamFrame.h
├── GPUTextureInput.h
├── GPUTriangleFilter.h
├── GPUTwoPassFilter.h
├── GPUVertexBuffer.h
├── GPUVideoFrame.h
├── GPUView.h
├── GPUWhiteningFilter.h
├── GPUYUV420Filter.h
├── GPUYUVFilter.h
├── GPUZoomFilter.h
├── bs.h
├── bs_common.h
├── bs_conf.h
├── bs_cqueue.h
├── bs_data.h
├── bs_def.h
├── bs_error.h
├── bs_file.h
├── bs_hashmap.h
├── bs_list.h
├── bs_lock.h
├── bs_log.h
├── bs_macros.h
├── bs_mmap.h
├── bs_object.h
├── bs_pack.h
├── bs_pool.h
├── bs_sign.h
├── bs_socket.h
├── bs_string.h
├── bs_struct.h
├── bs_timer.h
├── bs_type.h
├── bs_url.h
└── bs_vector.h
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 |
7 | # Precompiled Headers
8 | *.gch
9 | *.pch
10 |
11 | # Compiled Dynamic libraries
12 | *.so
13 | *.dylib
14 | *.dll
15 |
16 | # Fortran module files
17 | *.mod
18 | *.smod
19 |
20 | # Compiled Static libraries
21 | *.lai
22 | *.la
23 | *.a
24 | *.lib
25 |
26 | # Executables
27 | *.exe
28 | *.out
29 | *.app
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # libGPU
2 | 一个类似GPUImage的跨平台图片、视频处理库。
3 |
4 | C++实现,完美支持安卓+ios,cpu占用率大约是GPUImage的1/3。
5 |
6 | 包含安卓+ios的美颜+滤镜+裁剪+转码功能
7 |
8 | ### 功能列表
9 | * pipeline:多种filter串行叠加
10 | * 滤镜:十几款滤镜
11 | * 裁剪+缩放
12 | * 叠加:随意添加元素、logo、水印等
13 | * 转码,rgb <-> yuv <-> nv21、nv12、I420
14 |
15 | ### History
16 | * 2018.3.27 适配opengles 3.0
17 | * 2018.7.15 添加安卓、ios相机滤镜demo
18 | * 2022.2.12 处理几个编译错误和滤镜加载错误,注意打开demo app前授予权限。
19 |
20 | # English
21 | An cross-platform open source framework for GPU-based image and video processing like GPUImage
22 |
--------------------------------------------------------------------------------
/example/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/.DS_Store
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/example/android/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/example/android/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/example/android/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
19 |
20 |
--------------------------------------------------------------------------------
/example/android/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/android/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/example/android/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 27
5 | defaultConfig {
6 | applicationId "com.rex.gpu.demo"
7 | minSdkVersion 21
8 | targetSdkVersion 27
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 |
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | debug {
20 | jniDebuggable true
21 | }
22 | }
23 | sourceSets.main{
24 | jni.srcDirs = ['cpp']
25 | }
26 | externalNativeBuild {
27 | ndkBuild {
28 | path 'src/main/cpp/Android.mk'
29 | }
30 | }
31 | }
32 |
33 | dependencies {
34 | implementation fileTree(include: ['*.jar'], dir: 'libs')
35 | implementation 'com.android.support:appcompat-v7:27.1.1'
36 | implementation 'com.android.support.constraint:constraint-layout:1.1.2'
37 | testImplementation 'junit:junit:4.12'
38 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
39 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
40 | }
41 |
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/example/android/app/src/androidTest/java/com/rex/gpu/demo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.rex.gpu.demo;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.rex.gpu.demo", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter0.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter1.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter10.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter11.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter13.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter15.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter16.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter17.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter18.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter2.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter20.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter21.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter3.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter4.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter5.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter6.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter7.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter8.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter86.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter86.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/filter9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/filter9.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/logo.png
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/suyan.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/assets/suyan.jpeg
--------------------------------------------------------------------------------
/example/android/app/src/main/cpp/Android.mk:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2009 The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | include $(all-subdir-makefiles)
16 |
--------------------------------------------------------------------------------
/example/android/app/src/main/cpp/Application.mk:
--------------------------------------------------------------------------------
1 | #APP_ABI := all
2 | #APP_ABI := armeabi-v7a
3 | APP_ABI := armeabi-v7a arm64-v8a
4 | # 推荐使用stl库
5 | APP_STL := c++_static
6 | #APP_PLATFORM := android-19
7 | # 调试
8 | #APP_OPTIM := debug
9 |
--------------------------------------------------------------------------------
/example/android/app/src/main/cpp/gpu:
--------------------------------------------------------------------------------
1 | ../../../../../../src
--------------------------------------------------------------------------------
/example/android/app/src/main/cpp/native/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 | LOCAL_MODULE_FILENAME = libnative
5 | LOCAL_CFLAGS := -D__ANDROID__ -D__DEBUG__ -g
6 |
7 | LOCAL_SRC_FILES := \
8 | NativeLoad.cpp
9 |
10 | LOCAL_LDLIBS := -llog -landroid -ldl
11 | LOCAL_MODULE := native
12 |
13 | include $(BUILD_SHARED_LIBRARY)
14 |
15 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/rex/gpu/GPURawBytesCallback.java:
--------------------------------------------------------------------------------
1 | package com.rex.gpu;
2 |
3 | /**
4 | * Created by Visionin on 16/7/27.
5 | */
6 | public interface GPURawBytesCallback {
7 | public void outputBytes(byte[] bytes);
8 | }
9 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/rex/load/NativeLoad.java:
--------------------------------------------------------------------------------
1 | package com.rex.load;
2 |
3 | import android.content.Context;
4 | import com.rex.utils.DeviceUtil;
5 |
6 | /**
7 | * Created by Visionin on 16/8/12.
8 | */
9 | public class NativeLoad {
10 | static {
11 | System.loadLibrary("native");
12 | }
13 |
14 | public static long so;
15 | static public native long loadSo(String so);
16 | static public native int registJNIMethod(long so, String className, String funcName, String signature);
17 |
18 | /*
19 | 类型 相应的签名
20 | boolean Z
21 | byte B
22 | char C
23 | short S
24 | int I
25 | long J
26 | float F
27 | double D
28 | void V
29 | object L用/分隔包的完整类名: Ljava/lang/String;
30 | Array [签名 [I [Ljava/lang/Object;
31 | Method (参数1类型签名 参数2类型签名···)返回值类型签名
32 | 复制代码
33 | 特别注意:Object后面一定有分号(;)结束的,多个对象参数中间也用分号(;)来分隔
34 | 例子:
35 | 方法签名
36 | void f1() ()V
37 | int f2(int, long) (IJ)I
38 | boolean f3(int[]) ([I)B
39 | double f4(String, int) (Ljava/lang/String;I)D
40 | void f5(int, String [], char) (I[Ljava/lang/String;C)V
41 | */
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/rex/utils/ApkUtil.java:
--------------------------------------------------------------------------------
1 | package com.rex.utils;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 |
7 | import java.io.File;
8 |
9 | /**
10 | * Created by Rex on 14-5-20.
11 | */
12 | public class ApkUtil {
13 |
14 | public static void install(Context context,String filePath)
15 | {
16 | Intent intent = new Intent(Intent.ACTION_VIEW);
17 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
18 | intent.setDataAndType(Uri.fromFile(new File(filePath)), "application/vnd.android.package-archive");
19 | context.startActivity(intent);
20 | }
21 |
22 | public static void unInstall(Context context,String packageString)
23 | {
24 | Uri packageURI = Uri.parse("package:"+packageString); //com.demo.CanavaCancel
25 | Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
26 | context.startActivity(uninstallIntent);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/rex/utils/LogUtil.java:
--------------------------------------------------------------------------------
1 | package com.rex.utils;
2 |
3 | import java.io.FileWriter;
4 | import java.io.IOException;
5 | import java.text.SimpleDateFormat;
6 | import java.util.Date;
7 |
8 | /**
9 | * Created by Rex on 14-8-18.
10 | */
11 | public class LogUtil {
12 | public static void initialize(String path){
13 | LogUtil.path = path;
14 | }
15 |
16 | public static void log(String type, String s){
17 | try {
18 | Date date = new Date();
19 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
20 | SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
21 | FileWriter writer = new FileWriter(path+ dateFormat.format(date) +".log", true);
22 | writer.append("["+type+"]"+ timeFormat.format(date)+"\t\t"+ s+"\n");
23 | writer.close();
24 | } catch (IOException e) {
25 | e.printStackTrace();
26 | }
27 | }
28 | public static void debug(String s){
29 | log("debug", s);
30 | }
31 | public static void notice(String s){
32 | log("notice", s);
33 | }
34 | public static void err(String s){
35 | log("err", s);
36 | }
37 | private static String path = null;
38 | }
39 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
27 |
28 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | GPUDemo
3 |
4 | - 无
5 | - filter0
6 | - filter1
7 | - filter2
8 | - filter3
9 | - filter4
10 | - filter5
11 | - filter6
12 | - filter7
13 | - filter8
14 | - filter9
15 | - filter10
16 | - filter11
17 | - filter13
18 | - filter15
19 | - filter16
20 | - filter17
21 | - filter18
22 | - filter20
23 | - filter21
24 | - filter86
25 |
26 |
27 | - 原始尺寸
28 | - 1 : 1
29 | - 3 : 2
30 | - 16: 9
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/example/android/app/src/test/java/com/rex/gpu/demo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.rex.gpu.demo;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:7.0.4'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Feb 12 00:48:15 CST 2022
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/example/ios/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/.DS_Store
--------------------------------------------------------------------------------
/example/ios/ZipArchive/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | xcuserdata/
4 | *.xccheckout
5 | *.moved-aside
6 |
7 | # AppCode
8 | .idea
9 |
10 | # macOS
11 | .DS_Store
12 |
13 | # CocoaPods
14 | #
15 | # We recommend against adding the Pods directory to your .gitignore. However
16 | # you should judge for yourself, the pros and cons are mentioned at:
17 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
18 | Pods/
19 |
20 | # Carthage
21 | #
22 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
23 | **/Carthage/Checkouts
24 | **/Carthage/Build
--------------------------------------------------------------------------------
/example/ios/ZipArchive/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010-2015, Sam Soffes, http://soff.es
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // ObjectiveCExample
4 | //
5 | // Created by Sean Soper on 10/23/15.
6 | //
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "83.5x83.5",
66 | "scale" : "2x"
67 | }
68 | ],
69 | "info" : {
70 | "version" : 1,
71 | "author" : "xcode"
72 | }
73 | }
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample/Sample Data/2.md:
--------------------------------------------------------------------------------
1 | # Test # 2
2 |
3 | ** This is a second test file **
4 |
5 | Morbi vel metus quis lorem tincidunt tempus sit amet quis magna. Nullam dolor dolor, eleifend in vestibulum nec, auctor at ipsum. Nullam viverra neque eros, a vehicula lacus tempus vitae. In sapien sapien, gravida mollis lectus sed, luctus egestas massa. Donec mollis tortor sit amet erat gravida ornare at sed felis. In ornare posuere velit, quis ultrices velit porta eget. Proin eu ultrices felis, eu finibus dolor. Quisque ultrices id libero at euismod. Sed mollis lacus id leo dignissim condimentum eget ac nunc. Vestibulum sed congue velit. Curabitur semper non lorem vel cursus. Ut sed augue purus. Sed sit amet faucibus ante, vel blandit justo. Duis id lacinia ex. Nullam pulvinar eget lacus in tristique. Nam et odio consequat, vehicula mauris ut, vulputate mi.
6 |
7 | Pellentesque feugiat, nulla in dictum lacinia, risus sapien aliquam magna, vitae efficitur neque mauris sagittis neque. Etiam eu hendrerit erat. Vestibulum aliquet sapien sed fermentum ultricies. Maecenas eu risus nec turpis semper consequat. Cras nisl diam, consequat ut orci nec, rutrum cursus est. Quisque dictum nunc leo, lobortis lacinia nisl ultrices eget. Ut imperdiet eu libero quis blandit. Nunc blandit, leo quis rutrum auctor, ex tortor vehicula sem, eu ultrices ipsum mi vel arcu. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
8 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample/Sample Data/mountain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample/Sample Data/mountain.png
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // ObjectiveCExample
4 | //
5 | // Created by Sean Soper on 10/23/15.
6 | //
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExample/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ObjectiveCExample
4 | //
5 | // Created by Sean Soper on 10/23/15.
6 | //
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/CancelDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // CancelDelegate.h
3 | // ObjectiveCExample
4 | //
5 | // Created by Antoine Cœur on 04/10/2017.
6 | //
7 |
8 | #import
9 | #import "SSZipArchive.h"
10 |
11 | @interface CancelDelegate : NSObject
12 | @property (nonatomic, assign) int numFilesUnzipped;
13 | @property (nonatomic, assign) int numFilesToUnzip;
14 | @property (nonatomic, assign) BOOL didUnzipArchive;
15 | @property (nonatomic, assign) int loaded;
16 | @property (nonatomic, assign) int total;
17 | @end
18 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/CancelDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // CancelDelegate.m
3 | // ObjectiveCExample
4 | //
5 | // Created by Antoine Cœur on 04/10/2017.
6 | //
7 |
8 | #import "CancelDelegate.h"
9 |
10 | @implementation CancelDelegate
11 | - (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
12 | {
13 | _numFilesUnzipped = (int)fileIndex + 1;
14 | }
15 | - (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
16 | {
17 | //return YES;
18 | return _numFilesUnzipped < _numFilesToUnzip;
19 | }
20 | - (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath
21 | {
22 | _didUnzipArchive = YES;
23 | }
24 | - (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total
25 | {
26 | _loaded = (int)loaded;
27 | _total = (int)total;
28 | }
29 | @end
30 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "SSZipArchive.h"
3 |
4 | /**
5 | * Test delegate by collecting its calls
6 | */
7 | @interface CollectingDelegate : NSObject
8 | @property(nonatomic, retain) NSMutableArray *files;
9 | @end
10 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // Created by chris on 8/1/12.
3 | //
4 | // To change the template use AppCode | Preferences | File Templates.
5 | //
6 |
7 |
8 | #import "CollectingDelegate.h"
9 |
10 | @implementation CollectingDelegate
11 |
12 | @synthesize files = _files;
13 |
14 | - (instancetype)init {
15 | self = [super init];
16 | if (self) {
17 | self.files = [NSMutableArray array];
18 | }
19 | return self;
20 | }
21 |
22 | - (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath {
23 | [self.files addObject:unzippedFilePath];
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/Empty.zip:
--------------------------------------------------------------------------------
1 | PK
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/IncorrectHeaders.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/IncorrectHeaders.zip
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PathTraversal.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PathTraversal.zip
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/RelativeSymbolicLink.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/RelativeSymbolicLink.zip
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/SymbolicLink.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/SymbolicLink.zip
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/TestArchive.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/TestArchive.zip
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/TestPasswordArchive.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/TestPasswordArchive.zip
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/Unicode.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/Unicode.zip
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/hello.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/hello.zip
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/0.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/0.m4a
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/1.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/1.m4a
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/2.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/2.m4a
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/3.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/3.m4a
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/4.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/4.m4a
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/5.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/5.m4a
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/6.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/6.m4a
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/7.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/7.m4a
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/ObjectiveCExampleTests/ProgressDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // ProgressDelegate.h
3 | // ObjectiveCExample
4 | //
5 | // Created by Antoine Cœur on 04/10/2017.
6 | //
7 |
8 | #import
9 | #import "SSZipArchive.h"
10 |
11 | @interface ProgressDelegate : NSObject
12 | {
13 | @public
14 | NSMutableArray *progressEvents;
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 |
3 | # inhibit_all_warnings!
4 | use_frameworks!
5 |
6 | abstract_target 'core' do
7 |
8 | pod 'SSZipArchive', :path => '..'
9 |
10 | target 'ObjectiveCExample' do
11 | platform :ios
12 | end
13 |
14 | target 'ObjectiveCExampleTests_iOS' do
15 | platform :ios
16 | end
17 |
18 | target 'ObjectiveCExampleTests_macOS' do
19 | platform :osx, '10.8'
20 | end
21 |
22 | target 'ObjectiveCExampleTests_tvOS' do
23 | platform :tvos, '9.0'
24 | end
25 |
26 | end
27 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ObjectiveCExample/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SSZipArchive (2.1.4)
3 |
4 | DEPENDENCIES:
5 | - SSZipArchive (from `..`)
6 |
7 | EXTERNAL SOURCES:
8 | SSZipArchive:
9 | :path: ".."
10 |
11 | SPEC CHECKSUMS:
12 | SSZipArchive: 18891f81644ecfc89df4a3aa29ed6d0788156cb9
13 |
14 | PODFILE CHECKSUM: 5e250843c66c607960128ebfe02ab7d6569102be
15 |
16 | COCOAPODS: 1.5.3
17 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/Release-Instructions.md:
--------------------------------------------------------------------------------
1 | The following steps should be taking by project maintainers if they create a new release.
2 |
3 | 1. Create a new release and tag for the release.
4 |
5 | - Tags should be in the form of vMajor.Minor.Revision
6 |
7 | - Release names should be more human readable: Version Major.Minor.Revision
8 |
9 | 2. Update the podspec and test it
10 |
11 | - *pod lib lint SSZipArchive.podspec*
12 |
13 | 3. Push the pod to the trunk
14 |
15 | - *pod trunk push SSZipArchive.podspec*
16 |
17 | 4. Create a Carthage framework archive
18 |
19 | - *carthage build --no-skip-current*
20 | - *carthage archive ZipArchive*
21 |
22 | 5. Attach archive to the release created in step 1.
23 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SSZipArchive.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'SSZipArchive'
3 | s.version = '2.1.4'
4 | s.summary = 'Utility class for zipping and unzipping files on iOS, tvOS, watchOS, and macOS.'
5 | s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS, tvOS, watchOS, and macOS.'
6 | s.homepage = 'https://github.com/ZipArchive/ZipArchive'
7 | s.license = { :type => 'MIT', :file => 'LICENSE.txt' }
8 | s.authors = { 'Sam Soffes' => 'sam@soff.es', 'Joshua Hudson' => nil, 'Antoine Cœur' => nil }
9 | s.source = { :git => 'https://github.com/ZipArchive/ZipArchive.git', :tag => "v#{s.version}" }
10 | s.ios.deployment_target = '4.3'
11 | s.tvos.deployment_target = '9.0'
12 | s.osx.deployment_target = '10.8'
13 | s.watchos.deployment_target = '2.0'
14 | s.source_files = 'SSZipArchive/*.{m,h}', 'SSZipArchive/minizip/*.{c,h}', 'SSZipArchive/minizip/aes/*.{c,h}'
15 | s.public_header_files = 'SSZipArchive/*.h'
16 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
17 | s.library = 'z'
18 | end
19 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SSZipArchive/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SSZipArchive/ZipArchive.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZipArchive.h
3 | // ZipArchive
4 | //
5 | // Created by Serhii Mumriak on 12/1/15.
6 | // Copyright © 2015 smumryak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for ZipArchive.
12 | FOUNDATION_EXPORT double ZipArchiveVersionNumber;
13 |
14 | //! Project version string for ZipArchive.
15 | FOUNDATION_EXPORT const unsigned char ZipArchiveVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 | #import "SSZipArchive.h"
20 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SSZipArchive/minizip/aes/pwd2key.h:
--------------------------------------------------------------------------------
1 | /*
2 | ---------------------------------------------------------------------------
3 | Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved.
4 |
5 | The redistribution and use of this software (with or without changes)
6 | is allowed without the payment of fees or royalties provided that:
7 |
8 | source code distributions include the above copyright notice, this
9 | list of conditions and the following disclaimer;
10 |
11 | binary distributions include the above copyright notice, this list
12 | of conditions and the following disclaimer in their documentation.
13 |
14 | This software is provided 'as is' with no explicit or implied warranties
15 | in respect of its operation, including, but not limited to, correctness
16 | and fitness for purpose.
17 | ---------------------------------------------------------------------------
18 | Issue Date: 20/12/2007
19 |
20 | This is an implementation of RFC2898, which specifies key derivation from
21 | a password and a salt value.
22 | */
23 |
24 | #ifndef PWD2KEY_H
25 | #define PWD2KEY_H
26 |
27 | #if defined(__cplusplus)
28 | extern "C"
29 | {
30 | #endif
31 |
32 | void derive_key(
33 | const unsigned char pwd[], /* the PASSWORD, and */
34 | unsigned int pwd_len, /* its length */
35 | const unsigned char salt[], /* the SALT and its */
36 | unsigned int salt_len, /* length */
37 | unsigned int iter, /* the number of iterations */
38 | unsigned char key[], /* space for the output key */
39 | unsigned int key_len); /* and its required length */
40 |
41 | #if defined(__cplusplus)
42 | }
43 | #endif
44 |
45 | #endif
46 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SSZipArchive/minizip/minishared.h:
--------------------------------------------------------------------------------
1 | #ifndef _MINISHARED_H
2 | #define _MINISHARED_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #ifdef _WIN32
9 | # define MKDIR(d) _mkdir(d)
10 | # define CHDIR(d) _chdir(d)
11 | #else
12 | # define MKDIR(d) mkdir(d, 0775)
13 | # define CHDIR(d) chdir(d)
14 | #endif
15 |
16 | /***************************************************************************/
17 |
18 | /* Get a file's date and time in dos format */
19 | uint32_t get_file_date(const char *path, uint32_t *dos_date);
20 |
21 | /* Sets a file's date and time in dos format */
22 | void change_file_date(const char *path, uint32_t dos_date);
23 |
24 | /* Convert dos date/time format to struct tm */
25 | int dosdate_to_tm(uint64_t dos_date, struct tm *ptm);
26 |
27 | /* Convert dos date/time format to time_t */
28 | time_t dosdate_to_time_t(uint64_t dos_date);
29 |
30 | /* Convert struct tm to dos date/time format */
31 | uint32_t tm_to_dosdate(const struct tm *ptm);
32 |
33 | /* Create a directory and all subdirectories */
34 | int makedir(const char *newdir);
35 |
36 | /* Check to see if a file exists */
37 | int check_file_exists(const char *path);
38 |
39 | /* Check to see if a file is over 4GB and needs ZIP64 extension */
40 | int is_large_file(const char *path);
41 |
42 | /* Print a 64-bit number for compatibility */
43 | void display_zpos64(uint64_t n, int size_char);
44 |
45 | /***************************************************************************/
46 |
47 | #ifdef __cplusplus
48 | }
49 | #endif
50 |
51 | #endif /* _MINISHARED_H */
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/Cartfile:
--------------------------------------------------------------------------------
1 | github "ZipArchive/ZipArchive"
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 |
3 | # inhibit_all_warnings!
4 | use_frameworks!
5 |
6 | target 'SwiftExample' do
7 | pod 'SSZipArchive', :path => '..'
8 | platform :ios
9 | end
10 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SSZipArchive (2.1.4)
3 |
4 | DEPENDENCIES:
5 | - SSZipArchive (from `..`)
6 |
7 | EXTERNAL SOURCES:
8 | SSZipArchive:
9 | :path: ".."
10 |
11 | SPEC CHECKSUMS:
12 | SSZipArchive: 18891f81644ecfc89df4a3aa29ed6d0788156cb9
13 |
14 | PODFILE CHECKSUM: 0dc500eb72745751ccba7677de4da5534fcef36d
15 |
16 | COCOAPODS: 1.5.3
17 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/SwiftExample.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/SwiftExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/SwiftExample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/SwiftExample/Sample Data/2.md:
--------------------------------------------------------------------------------
1 | # Test # 2
2 |
3 | ** This is a second test file **
4 |
5 | Morbi vel metus quis lorem tincidunt tempus sit amet quis magna. Nullam dolor dolor, eleifend in vestibulum nec, auctor at ipsum. Nullam viverra neque eros, a vehicula lacus tempus vitae. In sapien sapien, gravida mollis lectus sed, luctus egestas massa. Donec mollis tortor sit amet erat gravida ornare at sed felis. In ornare posuere velit, quis ultrices velit porta eget. Proin eu ultrices felis, eu finibus dolor. Quisque ultrices id libero at euismod. Sed mollis lacus id leo dignissim condimentum eget ac nunc. Vestibulum sed congue velit. Curabitur semper non lorem vel cursus. Ut sed augue purus. Sed sit amet faucibus ante, vel blandit justo. Duis id lacinia ex. Nullam pulvinar eget lacus in tristique. Nam et odio consequat, vehicula mauris ut, vulputate mi.
6 |
7 | Pellentesque feugiat, nulla in dictum lacinia, risus sapien aliquam magna, vitae efficitur neque mauris sagittis neque. Etiam eu hendrerit erat. Vestibulum aliquet sapien sed fermentum ultricies. Maecenas eu risus nec turpis semper consequat. Cras nisl diam, consequat ut orci nec, rutrum cursus est. Quisque dictum nunc leo, lobortis lacinia nisl ultrices eget. Ut imperdiet eu libero quis blandit. Nunc blandit, leo quis rutrum auctor, ex tortor vehicula sem, eu ultrices ipsum mi vel arcu. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
8 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/SwiftExample/Sample Data/mountain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/SwiftExample/SwiftExample/Sample Data/mountain.png
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/SwiftExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/SwiftExample/SwiftExampleTests/SwiftExampleTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SwiftExampleTests.swift
3 | // SwiftExampleTests
4 | //
5 | // Created by Sean Soper on 10/23/15.
6 | //
7 | //
8 |
9 | import XCTest
10 | @testable import SwiftExample
11 |
12 | class SwiftExampleTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | // Use XCTAssert and related functions to verify your tests produce the correct results.
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measure {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ZipArchive.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/ZipArchive.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/ZipArchive/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/ZipArchive/icon.png
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/project.xcworkspace/xcuserdata/Rex.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example.xcodeproj/project.xcworkspace/xcuserdata/Rex.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/project.xcworkspace/xcuserdata/Visionin.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example.xcodeproj/project.xcworkspace/xcuserdata/Visionin.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/xcuserdata/Rex.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
24 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/xcuserdata/Rex.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | example.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | C8A0ADDC1ECFE5A10043ADE9
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/xcuserdata/Visionin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
24 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/xcuserdata/Visionin.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | example.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | C8A0ADDC1ECFE5A10043ADE9
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/example/ios/example/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/.DS_Store
--------------------------------------------------------------------------------
/example/ios/example/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // example
4 | //
5 | // Created by Visionin on 17/5/20.
6 | // Copyright © 2017年 Rex. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/example/ios/example/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/example/ios/example/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/example/HomeViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // HomeViewController.h
3 | // example
4 | //
5 | // Created by Rex on 2018/7/24.
6 | // Copyright © 2018年 Rex. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface HomeViewController : UIViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/example/ios/example/ImageViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ImageViewController.h
3 | // example
4 | //
5 | // Created by Rex on 2018/8/27.
6 | // Copyright © 2018年 Rex. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ImageViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/example/ios/example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSMicrophoneUsageDescription
6 | 麦克
7 | NSCameraUsageDescription
8 | 相机
9 | LSApplicationCategoryType
10 |
11 | CFBundleDevelopmentRegion
12 | en
13 | CFBundleExecutable
14 | $(EXECUTABLE_NAME)
15 | CFBundleIdentifier
16 | $(PRODUCT_BUNDLE_IDENTIFIER)
17 | CFBundleInfoDictionaryVersion
18 | 6.0
19 | CFBundleName
20 | $(PRODUCT_NAME)
21 | CFBundlePackageType
22 | APPL
23 | CFBundleShortVersionString
24 | 1.0
25 | CFBundleVersion
26 | 1
27 | LSRequiresIPhoneOS
28 |
29 | UILaunchStoryboardName
30 | LaunchScreen
31 | UIMainStoryboardFile
32 | Main
33 | UIRequiredDeviceCapabilities
34 |
35 | armv7
36 |
37 | UISupportedInterfaceOrientations
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationLandscapeLeft
41 | UIInterfaceOrientationLandscapeRight
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/example/ios/example/PictureViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // PictureViewController.h
3 | // example
4 | //
5 | // Created by Rex on 2018/9/5.
6 | // Copyright © 2018年 Rex. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PictureViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/example/ios/example/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // example
4 | //
5 | // Created by Visionin on 17/5/20.
6 | // Copyright © 2017年 Rex. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 | @end
14 |
15 |
--------------------------------------------------------------------------------
/example/ios/example/filter.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter.zip
--------------------------------------------------------------------------------
/example/ios/example/filter0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter0.png
--------------------------------------------------------------------------------
/example/ios/example/filter1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter1.png
--------------------------------------------------------------------------------
/example/ios/example/filter10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter10.png
--------------------------------------------------------------------------------
/example/ios/example/filter11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter11.png
--------------------------------------------------------------------------------
/example/ios/example/filter13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter13.png
--------------------------------------------------------------------------------
/example/ios/example/filter15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter15.png
--------------------------------------------------------------------------------
/example/ios/example/filter16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter16.png
--------------------------------------------------------------------------------
/example/ios/example/filter17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter17.png
--------------------------------------------------------------------------------
/example/ios/example/filter18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter18.png
--------------------------------------------------------------------------------
/example/ios/example/filter2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter2.png
--------------------------------------------------------------------------------
/example/ios/example/filter20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter20.png
--------------------------------------------------------------------------------
/example/ios/example/filter21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter21.png
--------------------------------------------------------------------------------
/example/ios/example/filter3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter3.png
--------------------------------------------------------------------------------
/example/ios/example/filter4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter4.png
--------------------------------------------------------------------------------
/example/ios/example/filter5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter5.png
--------------------------------------------------------------------------------
/example/ios/example/filter6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter6.png
--------------------------------------------------------------------------------
/example/ios/example/filter7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter7.png
--------------------------------------------------------------------------------
/example/ios/example/filter8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter8.png
--------------------------------------------------------------------------------
/example/ios/example/filter86.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter86.png
--------------------------------------------------------------------------------
/example/ios/example/filter9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/filter9.png
--------------------------------------------------------------------------------
/example/ios/example/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/logo.png
--------------------------------------------------------------------------------
/example/ios/example/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // example
4 | //
5 | // Created by Visionin on 17/5/20.
6 | // Copyright © 2017年 Rex. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/example/ios/example/suyan.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/example/ios/example/suyan.jpeg
--------------------------------------------------------------------------------
/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/.DS_Store
--------------------------------------------------------------------------------
/src/Android.mk:
--------------------------------------------------------------------------------
1 | include $(all-subdir-makefiles)
2 |
--------------------------------------------------------------------------------
/src/base/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/base/.DS_Store
--------------------------------------------------------------------------------
/src/base/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_CFLAGS += -D__ANDROID__ -D__DEBUG__ -g
5 | #APP_PLATFORM := android-23
6 |
7 | LOCAL_C_INCLUDES := \
8 | $(LOCAL_PATH)/../base \
9 | $(LOCAL_PATH)/../base/android \
10 | $(LOCAL_PATH)/../filter \
11 | $(LOCAL_PATH)/../bs
12 |
13 | SRCFILES = $(wildcard $(LOCAL_PATH)/*.cpp $(LOCAL_PATH)/*/*.cpp)
14 | SRCS = $(patsubst $(LOCAL_PATH)/%, ./%,$(SRCFILES))
15 |
16 | LOCAL_SRC_FILES += $(SRCS)
17 |
18 | LOCAL_MODULE := gpu
19 |
20 | include $(BUILD_STATIC_LIBRARY)
21 |
--------------------------------------------------------------------------------
/src/base/GPUBlendFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBlendFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-07-29 14:36
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUMBLENDFILTER_H_
11 | #define __GPUMBLENDFILTER_H_
12 |
13 | #include "GPUFilter.h"
14 | #include "GPUPicture.h"
15 |
16 | class GPUBlendFilter:public GPUFilter{
17 | public:
18 | GPUBlendFilter(int inputs=2);
19 | GPUBlendFilter(const char* fragment, int inputs=2);
20 | GPUBlendFilter(const char* vertex, const char* fragment, int inputs=2);
21 |
22 | virtual void newFrame();
23 |
24 | // 设置第几个texture的四角坐标,顺序 lt/rt/lb/rb
25 | void setDrawRect(gpu_point_t points[4], int i);
26 |
27 | const static int GPU_MUTABLE_TEXTURE_NUM = 8;
28 | const static char* g_mutable_vertext_shader;
29 | const static char* g_mutable_fragment_shader;
30 |
31 | protected:
32 | float m_coordinates[GPU_MUTABLE_TEXTURE_NUM][8]; // texture坐标
33 | };
34 | #endif
35 |
--------------------------------------------------------------------------------
/src/base/GPUFileFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUFileFilter.h
3 | * author : Rex
4 | * create : 2016-12-13 20:46
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUFILEFILTER_H_
10 | #define __GPUFILEFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 | #include "GPUPicture.h"
14 |
15 | extern const char* g_file_filter_map[];
16 | extern int g_file_filter_num;
17 |
18 | class GPUFileFilter: public GPUFilter{
19 | public:
20 | GPUFileFilter(const char* folder);
21 | ~GPUFileFilter();
22 |
23 | virtual void setInputFrameBuffer(GPUFrameBuffer* buffer, int location=0);
24 |
25 | bool exist(){ return m_exist; }
26 | protected:
27 | //用于查表的图片
28 | std::vector m_images;
29 | bool m_exist;
30 | };
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/src/base/GPUGroupFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUGroupFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-08-06 21:57
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUGROUPFILTER_H_
11 | #define __GPUGROUPFILTER_H_
12 |
13 | #include "GPUFilter.h"
14 |
15 | class GPUGroupFilter: public GPUFilter{
16 | public:
17 | GPUGroupFilter(const char* name = NULL);
18 | virtual void newFrame();
19 | virtual void setInputFrameBuffer(GPUFrameBuffer* buffer, int location=0);
20 | virtual void setOutputRotation(gpu_rotation_t rotation);
21 |
22 | inline void setFirstFilter(GPUFilter* f){
23 | m_input = f;
24 | }
25 |
26 | inline void setLastFilter(GPUFilter* f){
27 | m_output = f;
28 | }
29 |
30 | inline GPUFilter* getFirstFilter(){ return m_input; }
31 | inline GPUFilter* getLastFilter(){ return m_output; }
32 |
33 | GPUFilter* m_input; // Group内第一个filter
34 | GPUFilter* m_output; // Group内最后一个filter
35 | };
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/src/base/GPULineFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPULineFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2017-05-19 15:17
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPULINEFILTER_H_
11 | #define __GPULINEFILTER_H_
12 |
13 | #include "GL.h"
14 | #include "GPUFilter.h"
15 |
16 | class GPULineFilter:public GPUFilter{
17 | public:
18 | GPULineFilter(int width=720, int height=1280);
19 |
20 | virtual void initShader();
21 | virtual void render();
22 |
23 | // 线段宽度,像素数
24 | void setLineWidth(uint32_t width);
25 | virtual void setPoints(gpu_point_t* points, int n);
26 | virtual void setColors(gpu_colorf_t* color, int n);
27 | virtual void setColor(gpu_colorf_t* color, int i);
28 |
29 | // 利用360个点画三角形形成圆
30 | void drawPoint(float x, float y, uint32_t radius, float* color);
31 | // 利用360个点和圆心画扇形形成圆
32 | void drawRound(float x, float y, uint32_t radius, float* color);
33 |
34 | protected:
35 | GLuint m_color;
36 | uint32_t m_line_width; // 线条宽度,像素宽度
37 |
38 | std::vector m_points;
39 | std::vector m_colors;
40 | uint32_t m_vertex_count;
41 | };
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/src/base/GPUOutput.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUOutput.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-04-27 19:11
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUOUTPUT_H_
11 | #define __GPUOUTPUT_H_
12 |
13 | #include
14 | #include
15 | #include "GPUInput.h"
16 |
17 | using namespace std;
18 | class GPUOutput;
19 | typedef void (*GPUCompleteCallback_f)(GPUOutput *output, void *para);
20 |
21 | class GPUOutput {
22 | public:
23 | GPUOutput();
24 | ~GPUOutput() {
25 | reseto();
26 | }
27 |
28 | void reseto();
29 |
30 | /// 连接/删除(所有)下级连接
31 | virtual int addTarget(GPUInput *target, int location = 0);
32 | virtual bool removeTarget(GPUInput *target, int *location = NULL);
33 | virtual bool removeAllTargets();
34 | virtual void informTargets();
35 |
36 | int targetsCount();
37 | GPUInput* getTarget(int i, int &location);
38 |
39 | ///////////////////////////////////////////////////////
40 | /// 设置回调函数与回调参数
41 | void setCompleteCallback(GPUCompleteCallback_f complete, void* para);
42 |
43 | virtual void setOutputSize(uint32_t width, uint32_t height);
44 | gpu_size_t getOutputSize();
45 |
46 | GPUFrameBuffer* m_outbuffer;
47 | protected:
48 | std::vector m_targets;
49 | std::vector m_location;
50 |
51 | GPUCompleteCallback_f m_complete;
52 | void* m_para;
53 |
54 | // 输出尺寸
55 | uint32_t m_out_width;
56 | uint32_t m_out_height;
57 | };
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/src/base/GPUOutputFilter.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUOutputFilter.cpp
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2017-03-25 16:11
6 | * func :
7 | * history:
8 | */
9 |
10 | #include "GPUOutputFilter.h"
11 |
12 | GPUOutputFilter::GPUOutputFilter(gpu_pixel_format_t format){
13 | m_input = &m_zoom_filter;
14 | switch (format) {
15 | case GPU_BGRA:
16 | m_zoom_filter.setOutputFormat(GPU_BGRA);
17 | case GPU_RGBA:
18 | m_output = &m_zoom_filter;
19 | m_zoom_filter.addTarget(&m_raw_output);
20 | break;
21 | case GPU_I420:
22 | m_420_filter = new GPUToYUV420Filter();
23 | case GPU_NV12:
24 | m_420_filter = new GPUToNV12Filter();
25 | case GPU_NV21:
26 | m_420_filter = new GPUToNV21Filter();
27 | m_zoom_filter.addTarget(&m_yuv_filter);
28 | m_yuv_filter.addTarget(m_420_filter);
29 | m_420_filter->addTarget(&m_raw_output);
30 | break;
31 | default:
32 | err_log("Not supported output pixel format!");
33 | break;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/base/GPUOutputFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUOutputFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2017-03-25 16:11
6 | * func : 输出group,支持bgra、rgba、nv12、nv21、i420等格式输出
7 | * history:
8 | */
9 |
10 | #ifndef __GPUOUTPUTFILTER_H_
11 | #define __GPUOUTPUTFILTER_H_
12 |
13 | #include "GPUGroupFilter.h"
14 | #include "GPUZoomFilter.h"
15 | #include "GPUYUVFilter.h"
16 | #include "GPUYUV420Filter.h"
17 | #include "GPURawOutput.h"
18 |
19 | class GPUOutputFilter: public GPUGroupFilter{
20 | public:
21 | GPUOutputFilter(gpu_pixel_format_t format);
22 |
23 | inline unsigned char* getBuffer(unsigned char* buffer = NULL, uint32_t size = 0){
24 | return m_raw_output.getBuffer(buffer, size);
25 | }
26 | protected:
27 | GPUZoomFilter m_zoom_filter;
28 | GPURGBToYUVFilter m_yuv_filter;
29 | GPUFilter* m_420_filter;
30 | GPURawOutput m_raw_output;
31 | };
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/base/GPUPicture.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUPicture.cpp
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-08-10 17:06
6 | * func :
7 | * history:
8 | */
9 |
10 | #include "GPUPicture.h"
11 |
12 | GPUPicture::GPUPicture(uint8_t * data, int width, int height){
13 | m_option = GPUFrameBuffer::defaultFrameOption();
14 | setPixel(data, width, height);
15 | }
16 | GPUPicture::GPUPicture(uint8_t * data, int width, int height, gpu_frame_option_t* format){
17 | m_option = *format;
18 | setPixel(data, width, height);
19 | }
20 | void GPUPicture::setPixel(uint8_t* pixels, uint32_t width, uint32_t height){
21 | m_pixels = pixels;
22 | m_image_size.width = width;
23 | m_image_size.height = height;
24 |
25 | GPUContext::shareInstance()->makeCurrent();
26 | // 如果图片被循环利用,使用GPUBufferCache获取会导致图片内容被改
27 | m_outbuffer = new GPUFrameBuffer(width, height, &m_option, true);
28 | m_outbuffer->disableReference();
29 |
30 | //m_outbuffer->activeTexture(GL_TEXTURE0);
31 | m_outbuffer->setPixels(pixels);
32 | // no need to use self.outputTextureOptions here since pictures need this texture formats and type
33 | // glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (int)width, (int)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
34 | // glBindTexture(GL_TEXTURE_2D, 0);
35 |
36 | }
37 |
38 | void GPUPicture::processImage(){
39 | for (int i=0; isetInputFrameBuffer(m_outbuffer, m_location[i]);
42 | input->newFrame();
43 | }
44 | }
45 |
46 | GPUPicture::~GPUPicture(){
47 | if (m_outbuffer!=NULL) {
48 | m_outbuffer->release();
49 | delete m_outbuffer;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/base/GPUPicture.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUPicture.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-08-10 17:06
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUPICTURE_H_
11 | #define __GPUPICTURE_H_
12 |
13 | #include "bs.h"
14 | #include "GPUOutput.h"
15 | #include "GPUFrameBuffer.h"
16 |
17 | class GPUPicture: public GPUOutput{
18 | public:
19 | GPUPicture(){
20 | m_option = GPUFrameBuffer::defaultFrameOption();
21 | }
22 | GPUPicture(const char* path);
23 | GPUPicture(uint8_t * data, uint32_t size);
24 | GPUPicture(uint8_t * data, int width, int height);
25 | GPUPicture(uint8_t * data, int width, int height, gpu_frame_option_t* option);
26 | #if __IOS__
27 | GPUPicture(void* cgImageRef);
28 | // pathForResource路径初始化
29 | GPUPicture(const char* file, const char* type);
30 | #endif
31 | #if __ANDROID__
32 | GPUPicture(jobject bitmap);
33 | #endif
34 | ~GPUPicture();
35 |
36 | bool load(const char* path);
37 | bool load(uint8_t * data, uint32_t size);
38 | virtual bool exist(){ return m_exist; }
39 | void processImage();
40 | void setPixel(uint8_t* pixels, uint32_t width, uint32_t height);
41 |
42 | gpu_frame_option_t m_option;
43 | uint8_t* m_pixels;
44 | gpu_size_t m_image_size;
45 | protected:
46 | #if __IOS__
47 | void init(void* image);
48 | #endif
49 |
50 | bool hasProcessedImage;
51 | bool m_exist;
52 | };
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/src/base/GPUPixelBuffer.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUPixelBuffer.h
3 | * author : Rex
4 | * create : 2016-07-21 16:58
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUPIXELBUFFER_H_
10 | #define __GPUPIXELBUFFER_H_
11 |
12 | #include "GPUContext.h"
13 | #include "GPUFrameBuffer.h"
14 |
15 | class GPUPixelBuffer{
16 | public:
17 | /**
18 | * @size: pbo大小,width*height, size*4为实际rgba容量
19 | * @sync: 为同步或者异步模式
20 | */
21 | GPUPixelBuffer(int size, bool sync = true, int elem_size=1);
22 | ~GPUPixelBuffer();
23 | void* read(GPUFrameBuffer* framebuffer);
24 | void unactive();
25 |
26 | inline void lock(){
27 | pthread_mutex_lock(&m_lock);
28 | }
29 | inline void unlock(){
30 | pthread_mutex_unlock(&m_lock);
31 | }
32 | protected:
33 | GPUFrameBuffer* m_frame_buffer;
34 | GLuint m_buffer[2];
35 | GLuint m_map_index;
36 | GLubyte* m_ptr;
37 |
38 | pthread_mutex_t m_lock;
39 | GLuint m_pack_mode;
40 | uint32_t m_size;
41 | bool m_sync; // 是否同步
42 | bool m_first; // 是否第一帧
43 | };
44 | #endif
45 |
--------------------------------------------------------------------------------
/src/base/GPUProgram.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUProgram.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-05-09 22:30
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUPROGRAM_H_
11 | #define __GPUPROGRAM_H_
12 |
13 | #include "GL.h"
14 | #include "GPUContext.h"
15 |
16 | class GPUProgram{
17 | public:
18 | GPUProgram();
19 | GPUProgram(const char* vertex, const char* fragment, const char* filter = NULL);
20 | ~GPUProgram() {
21 | clearProgram();
22 | }
23 |
24 | GLint attributeIndex(const char* name);
25 | GLint uniformIndex(const char* name);
26 | void setUniformsIndex(const char* name, GLint* index, uint32_t size);
27 |
28 | void link();
29 | void use();
30 |
31 | GLuint getProgram(){
32 | return m_shader_program;
33 | }
34 |
35 | int setProgram(const char *fragment, const char *vertex = NULL);
36 |
37 | void setInteger(const char *name, int val);
38 | void setIntegerv(const char *name, int* val, int num);
39 | void setUIntegerv(const char *name, uint32_t* val, int num);
40 | void setFloat(const char* name, GLfloat val);
41 | void setFloat(const char* name, GLfloat* val, int num);
42 | void setFloatv(const char* name, GLfloat* val, int num);
43 | void setMatrix(const char* name, GLfloat* val, int num);
44 | void enableAttribArray(const char* name);
45 |
46 | const char* m_vertex_str;
47 | const char* m_fragment_str;
48 | const char* m_filter;
49 | protected:
50 | void compile(const char* vertex, const char* fragment);
51 | GLuint loadShader(GLenum shaderType, const char* pSource);
52 |
53 | protected:
54 | GLuint m_shader_program;
55 | GLuint m_vertex;
56 | GLuint m_fragment;
57 | bool m_shader_used;
58 |
59 | void clearProgram();
60 | };
61 |
62 | #endif
63 |
--------------------------------------------------------------------------------
/src/base/GPURawGroup.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPURawGroup.h
3 | * author : Rex
4 | * create : 2018-11-16 13:20
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPURAWGROUP_H_
10 | #define __GPURAWGROUP_H_
11 |
12 | #include "GPUGroupFilter.h"
13 | #include "GPUZoomFilter.h"
14 | #include "GPUYUVFilter.h"
15 | #include "GPUYUV420Filter.h"
16 |
17 | class GPURawGroup:public GPUGroupFilter{
18 | public:
19 | GPURawGroup();
20 | void setOutputFormat(gpu_pixel_format_t format);
21 |
22 | GPURawOutput m_raw_output;
23 | protected:
24 | gpu_pixel_format_t m_output_format;
25 |
26 | GPUZoomFilter m_zoom_filter;
27 |
28 | GPURGBToYUVFilter m_yuv_filter;
29 | GPUToYUV420Filter m_yuv420_filter;
30 | GPUToNV21Filter m_nv21_filter;
31 | GPUToNV12Filter m_nv12_filter;
32 | };
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/base/GPURawInput.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPURawInput.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-04-27 21:10
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPU_RAWINPUT_H_
11 | #define __GPU_RAWINPUT_H_
12 | #include "GPUContext.h"
13 | #include "GPUOutput.h"
14 | #include "GPUGroupFilter.h"
15 | #include "GPUYUVFilter.h"
16 |
17 | class GPURawInput: public GPUGroupFilter{
18 | public:
19 | GPURawInput(gpu_pixel_format_t format = GPU_RGBA);
20 | GPURawInput(int width, int height, gpu_pixel_format_t format = GPU_RGBA);
21 | ~GPURawInput();
22 |
23 | // m_width和m_height是输出尺寸,和此处width、height可能为旋转关系,注意区别
24 | void uploadBytes(GLubyte* bytes, int width, int height, gpu_pixel_format_t in_type = GPU_NV21);
25 | void uploadBytes(GLubyte* bytes);
26 |
27 | gpu_pixel_format_t getFormat(){
28 | return m_in_format;
29 | }
30 |
31 | protected:
32 | void setFormat(gpu_pixel_format_t format);
33 |
34 | gpu_pixel_format_t m_in_format;
35 | int m_width;
36 | int m_height;
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/base/GPURawOutput.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPURawOutput.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-06-01 14:41
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPURAWOUTPUT_H_
11 | #define __GPURAWOUTPUT_H_
12 |
13 | #include "GPUContext.h"
14 | #include "GPUFrameBuffer.h"
15 | #include "GPUInput.h"
16 |
17 | class GPURawOutput:public GPUInput{
18 | public:
19 | GPURawOutput(bool direct = false); // 默认直到获取buffer时候才从gpu中读取
20 | ~GPURawOutput();
21 | // 外部传入buffer
22 | void setBuffer(unsigned char* buffer, uint32_t size);
23 | // 从buffer中获取
24 | unsigned char * getBuffer(unsigned char* buffer = NULL, uint32_t size = 0);
25 | int getTexture();
26 | int getSize(){
27 | return m_size;
28 | }
29 |
30 | virtual void newFrame();
31 | virtual void setInputFrameBuffer(GPUFrameBuffer* buffer, int location=0);
32 |
33 | protected:
34 | GPUFrameBuffer* m_firstbuffer;
35 |
36 | unsigned char* m_bytebuffer;
37 | int m_size;
38 | bool m_direct;
39 | bool m_frame_get;
40 | };
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/src/base/GPUTextureInput.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUTextureInput.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-12-08 15:39
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUTEXTUREINPUT_H_
11 | #define __GPUTEXTUREINPUT_H_
12 |
13 | #include "GPUContext.h"
14 | #include "GPUOutput.h"
15 | #include "GPUFilter.h"
16 |
17 | class GPUTextureInput: public GPUFilter {
18 | public:
19 | GPUTextureInput();
20 | GPUTextureInput(int width, int height, int texture_type = GPU_TEXTURE_OES);
21 | void processTexture();
22 | void processTexture(GLuint texture);
23 |
24 |
25 | /// void render();
26 | gpu_size_t getSize(){
27 | gpu_size_t size = {m_out_width, m_out_height};
28 | return size;
29 | }
30 | // 设置视频输出尺寸,可能和输入不一致,为旋转关系
31 | // void setOutputSize(int width, int height){
32 | // m_width = width;
33 | // m_height = height;
34 | // }
35 | virtual void render(); /// 重载父类函数,渲染流程,解锁输入
36 | protected:
37 | GLuint m_texture;
38 | int m_texture_type;
39 | /// int m_width, m_height;
40 | };
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/src/base/GPUTriangleFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUTriangleFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2017-02-25 23:32
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUTRIANGLEFILTER_H_
11 | #define __GPUTRIANGLEFILTER_H_
12 |
13 | #include "GPUFilter.h"
14 |
15 | class GPUTriangleFilter: public GPUFilter{
16 | public:
17 | GPUTriangleFilter(const char* fragment, int inputs=1, int vertex=4);
18 | void setVertex(float* vertex, int count);
19 |
20 | virtual void render();
21 | };
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/base/GPUTriangleFilter.h.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUVertexFilter.cpp
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2017-02-25 23:32
6 | * func :
7 | * history:
8 | */
9 |
10 | #include "GPUTriangleFilter.h"
11 |
12 | GPUTriangleFilter::GPUTriangleFilter(const char* fragment, int inputs, int vertex):
13 | GPUFilter(fragment, inputs){
14 | m_vertices.resize(vertex*2);
15 | }
16 |
17 | void GPUTriangleFilter::setVertex(float* vertex, int count){
18 | m_vertices.resize(count*2);
19 | }
20 |
21 | void GPUTriangleFilter::render(){
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/base/GPUTwoPassFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUTwoPassFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-05-05 19:49
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUTWOPASSFILTER_H_
11 | #define __GPUTWOPASSFILTER_H_
12 | #include "GPUFilter.h"
13 |
14 | class GPUTwoPassFilter: public GPUFilter{
15 | public:
16 | GPUTwoPassFilter();
17 | GPUTwoPassFilter(const char* first_fragment, const char* second_fragment);
18 | GPUTwoPassFilter(const char* first_vertext, const char* first_fragment, const char* second_vertext, const char* second_fragment);
19 |
20 | virtual ~GPUTwoPassFilter(){
21 | delete m_first_filter;
22 | m_first_filter = NULL;
23 | delete m_second_filter;
24 | m_second_filter = NULL;
25 | }
26 |
27 | virtual void init_filter();
28 | void render();
29 | virtual void setInputFrameBuffer(GPUFrameBuffer* buffer, int location=0);
30 | virtual void setOutputRotation(gpu_rotation_t rotation){
31 | m_rotation = rotation;
32 | m_first_filter->setOutputRotation(rotation);
33 | }
34 |
35 | // 修改shader
36 | void changeShader(const char* first_fragment, const char* second_fragment);
37 | protected:
38 | GPUFilter* m_first_filter;
39 | GPUFilter* m_second_filter;
40 | };
41 | #endif
42 |
--------------------------------------------------------------------------------
/src/base/GPUView.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : gpu_view.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-04-27 19:13
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPU_VIEW_H_
11 | #define __GPU_VIEW_H_
12 | #ifdef __ANDROID__
13 | #include
14 | #include
15 | #endif
16 | #include "GPUFilter.h"
17 |
18 | class GPUView: public GPUFilter{
19 | // class GPUView: public GPUFilter{
20 | public:
21 | GPUView(int width, int height);
22 | #ifdef __ANDROID__
23 | GPUView(ANativeWindow * surface);
24 | void setNativeWindow(ANativeWindow * surface);
25 | #endif
26 | ~GPUView();
27 |
28 | virtual void newFrame();
29 |
30 | protected:
31 | GLuint m_displaybuffer;
32 | GLuint m_displayrender;
33 |
34 | #ifdef __ANDROID__
35 | void createWindowContext();
36 |
37 | EGLSurface m_eglsurface;
38 | ANativeWindow* m_surface;
39 | #endif
40 | };
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/src/base/GPUZoomFilter.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUZoomFilter.cpp
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-07-12 20:33
6 | * func :
7 | * history:
8 | */
9 |
10 | #include "GPUZoomFilter.h"
11 |
12 | // ios需要输出bgra格式
13 | static const char* g_bgra_fragment_shader = SHADER_STRING(
14 | varying vec2 textureCoordinate;
15 | //uniform samplerExternalOES inputImageTexture;
16 | uniform sampler2D inputImageTexture;
17 |
18 | void main()
19 | {
20 | gl_FragColor = texture2D(inputImageTexture, textureCoordinate).bgra;
21 | }
22 | );
23 | static const char* g_argb_fragment_shader = SHADER_STRING(
24 | varying vec2 textureCoordinate;
25 | //uniform samplerExternalOES inputImageTexture;
26 | uniform sampler2D inputImageTexture;
27 |
28 | void main()
29 | {
30 | gl_FragColor = texture2D(inputImageTexture, textureCoordinate).argb;
31 | }
32 | );
33 |
34 | GPUZoomFilter::GPUZoomFilter(gpu_fill_mode_t mode)
35 | {
36 | setFillMode(mode);
37 | }
38 |
39 | void GPUZoomFilter::render(){
40 | GPUFilter::render();
41 | glFinish();
42 | }
43 |
44 | void GPUZoomFilter::setOutputFormat(gpu_pixel_format_t format){
45 | const char* fragment = NULL;
46 | switch (format){
47 | case GPU_BGRA:
48 | fragment = g_bgra_fragment_shader;
49 | break;
50 | case GPU_ARGB:
51 | fragment = g_argb_fragment_shader;
52 | break;
53 | default:
54 | fragment = g_fragment_shader;
55 | }
56 | changeShader(fragment, g_vertex_shader);
57 | }
58 |
--------------------------------------------------------------------------------
/src/base/GPUZoomFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUZoomFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-07-12 20:33
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUZOOMFILTER_H_
11 | #define __GPUZOOMFILTER_H_
12 |
13 | #include "GPUFilter.h"
14 |
15 | class GPUZoomFilter:public GPUFilter{
16 | public:
17 | GPUZoomFilter(gpu_fill_mode_t mode=GPUFillModePreserveAspectRatioAndFill);
18 | virtual void render();
19 | // 只支持RGBA和BGRA
20 | void setOutputFormat(gpu_pixel_format_t format);
21 | };
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/base/android/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/base/android/.DS_Store
--------------------------------------------------------------------------------
/src/base/ios/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/base/ios/.DS_Store
--------------------------------------------------------------------------------
/src/base/ios/GPUIOSBuffer.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUIOSBuffer.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-07-08 16:08
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUIOSBUFFER_H_
11 | #define __GPUIOSBUFFER_H_
12 |
13 | #import
14 | #import
15 | #import
16 | #include "GPUFrameBuffer.h"
17 |
18 | class GPUIOSFrameBuffer: public GPUFrameBuffer{
19 | public:
20 | GPUIOSFrameBuffer(gpu_size_t size, bool only_texture = true);
21 | GPUIOSFrameBuffer(int width, int height, bool only_texture = true);
22 | GPUIOSFrameBuffer(int width, int height, gpu_frame_option_t* option, bool only_texture = true);
23 | GPUIOSFrameBuffer(int width, int height, GLuint texture);
24 |
25 | virtual void generateFrameBuffer();
26 | CVPixelBufferRef getPixelBuffer(){
27 | return m_render_target;
28 | }
29 |
30 | ~GPUIOSFrameBuffer();
31 | protected:
32 |
33 | CVPixelBufferRef m_render_target;
34 | CVOpenGLESTextureRef m_render_texture;
35 | };
36 |
37 | class GPUIOSBufferCache:public GPUBufferCache{
38 | public:
39 | static GPUBufferCache* shareInstance();
40 | protected:
41 |
42 | virtual GPUFrameBuffer* newFrameBuffer(int width, int height, gpu_frame_option_t* option, bool only_texture=true);
43 | };
44 | #endif
45 |
--------------------------------------------------------------------------------
/src/base/ios/GPUSampleBufferInput.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUSampleBufferInput.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2017-03-25 20:41
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUSAMPLEBUFFERINPUT_H_
11 | #define __GPUSAMPLEBUFFERINPUT_H_
12 |
13 | #include
14 | #include
15 | #include "GPU.h"
16 | #include "GPUGroupFilter.h"
17 | #include "GPUYUVFilter.h"
18 | #include "GPUIOSBuffer.h"
19 |
20 | class GPUSampleBufferInput: public GPUGroupFilter{
21 | public:
22 | GPUSampleBufferInput();
23 | ~GPUSampleBufferInput();
24 | // 视频流处理
25 | void processSampleBuffer(CMSampleBufferRef sampleBuffer);
26 | void processPixelBuffer(CVImageBufferRef pixelBuffer);
27 |
28 | GPUIOSFrameBuffer* m_rawbuffer;
29 | protected:
30 | OSType m_format; // 是否YUV数据
31 | };
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/bs/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/bs/.DS_Store
--------------------------------------------------------------------------------
/src/bs/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_CFLAGS += -D__ANDROID__ -g
5 | #APP_PLATFORM := android-19
6 |
7 | LOCAL_SRC_FILES += \
8 | bs_log.c \
9 | bs_socket.c \
10 | bs_sign.c \
11 | bs_list.c \
12 | bs_pool.c \
13 | bs_vector.c \
14 | bs_lock.c \
15 | bs_conf.c \
16 | bs_cqueue.c \
17 | bs_url.c \
18 | bs_common.c \
19 | bs_object.c \
20 | bs_string.c \
21 | bs_data.c \
22 | bs_file.c
23 | # bs_time里的signal函数在r10里不支持
24 | #When you use the ndk r10, android-21 is used by default but it's not fully retro-compatible with devices running former Android versions. In your case, signal can't be found on your device (but it would run properly on Lollipop).
25 | #When using the NDK, you should use the platform (APP_PLATFORM:=android-XX) that corresponds to your android:minSdkVersion.
26 | #So here you can set APP_PLATFORM:=android-15 inside Application.mk Makefile, and your lib will use the inline version of signal, so it will not look for its symbol at runtime.
27 | #bs_timer.c
28 |
29 | #LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
30 | LOCAL_MODULE := bs
31 |
32 | include $(BUILD_STATIC_LIBRARY)
33 |
--------------------------------------------------------------------------------
/src/bs/Makefile:
--------------------------------------------------------------------------------
1 | # Makefile
2 | # bushaofeng. 2011.8.27
3 | # ver=1.0.0
4 |
5 | OUTPUT = ./output
6 | OUTPUT_INC = $(OUTPUT)/include
7 | OUTPUT_LIB = $(OUTPUT)/lib
8 |
9 | INC_PATH = output/include
10 | LIB_PATH = output/lib
11 |
12 | include $(sys).mk
13 |
14 | INCLDIR = ./
15 |
16 | FPIC = -fPIC
17 | WARN_LEVL = -Wall
18 | FDEBUG = -g
19 | SHARED = -shared
20 | #STD_MODE = -std=c99
21 | STD_MODE = -std=gnu99
22 |
23 | EXTRA_OPT = $(FDEBUG)
24 | EXTRA_OPT += $(WARN_LEVL)
25 | EXTRA_OPT += $(FPIC)
26 | EXTRA_OPT += $(STD_MODE)
27 | #EXTRA_OPT += $(SHARED)
28 | #EXTRA_OPT += $(STD_MODE)
29 |
30 | OBJDIR = ./
31 | SRCS = $(wildcard ./*.c)
32 | OBJS = $(patsubst %.c,$(OBJDIR)/%.o,$(SRCS))
33 |
34 |
35 | TARGET=libbs.a
36 | $(TARGET):$(OBJS)
37 | mkdir -p $(OUTPUT_INC)
38 | mkdir -p $(OUTPUT_LIB)
39 | echo $(OBJS)
40 | ar -r libbs.a $(OBJS)
41 | cp -p *.h $(OUTPUT_INC)
42 | cp -p *.a $(OUTPUT_LIB)
43 |
44 | $(OBJS):%.o: %.c
45 | $(CC) -c $(LDFLAGS) $(EXTRA_OPT) -I$(INCLDIR) $^ -o $@
46 |
47 | clean:
48 | rm -rf $(OUTPUT) *.a *.o
49 |
--------------------------------------------------------------------------------
/src/bs/bs.h:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofeng. 2011.9.14
3 | * bs.h
4 | * history:
5 | */
6 |
7 | #ifndef __BS_H_
8 | #define __BS_H_
9 |
10 | #include "bs_type.h"
11 | #include "bs_error.h"
12 | #include "bs_def.h"
13 |
14 | #include "bs_mmap.h"
15 | #include "bs_conf.h"
16 | #include "bs_struct.h"
17 | #include "bs_log.h"
18 | #include "bs_common.h"
19 | #include "bs_sign.h"
20 | #include "bs_socket.h"
21 | #include "bs_pack.h"
22 | #include "bs_list.h"
23 | #include "bs_pool.h"
24 | #include "bs_vector.h"
25 | #include "bs_cqueue.h"
26 | #include "bs_timer.h"
27 | #include "bs_url.h"
28 | #include "bs_hashmap.h"
29 | #include "bs_object.h"
30 | #include "bs_string.h"
31 | #include "bs_data.h"
32 | #include "bs_file.h"
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/bs/bs_data.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_data.h
3 | * author : Rex
4 | * create : 2016-11-15 17:53
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __BS_DATA_H_
10 | #define __BS_DATA_H_
11 |
12 | #include "bs_type.h"
13 | #include "bs_error.h"
14 | #include "bs_object.h"
15 |
16 | #ifdef __cplusplus
17 | extern "C"{
18 | #endif
19 |
20 | #define STRING_DEF_SIZE 64
21 |
22 | typedef struct data_t{
23 | object_t base;
24 | uint32_t size;
25 | uint32_t len;
26 | char* mem;
27 | status_t (*set)(struct data_t* str, const char* s, uint32_t size);
28 | status_t (*append)(struct data_t* str, const char* s, uint32_t size);
29 | }data_t;
30 |
31 | void* data_init(void* p);
32 | void data_destroy(void* p);
33 | status_t data_set(struct data_t* str, const char* s, uint32_t size);
34 | status_t data_append(data_t* str, const char* s, uint32_t size);
35 |
36 | #define data_memory(s) ((s)->mem)
37 | // 内容长度,data的长度用size,string的长度用length
38 | #define data_size(s) ((s)->len)
39 |
40 | #ifdef __cplusplus
41 | }
42 | #endif
43 | #endif
44 |
--------------------------------------------------------------------------------
/src/bs/bs_def.h:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofeng. 2011.8.24
3 | * bs_define.h
4 | * history:
5 | */
6 |
7 | #ifndef __BS_DEF_H_
8 | #define __BS_DEF_H_
9 |
10 | #define BS_DEF_STRLEN 512
11 | #define BS_SHORT_STRLEN 64
12 | #define BS_LONG_STRLEN 1024
13 |
14 | #define BS_DEF_BUF_SIZE 256
15 |
16 | #define BS_DEF_ARYLEN 256
17 | #define BS_DEF_ADDLEN 128
18 | #define BS_LONG_ARYLEN 512
19 |
20 | #define BS_STREAM_BUFSIZE 1024000
21 |
22 | #define IP_SIZE 16
23 |
24 | #ifndef NULL
25 | #define NULL ((void*)0)
26 | #endif
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/src/bs/bs_error.h:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofneg. 2011.8.24
3 | * bs_error.h
4 | * history:
5 | */
6 |
7 | #ifndef __BS_ERROR_H_
8 | #define __BS_ERROR_H_
9 |
10 | #define BS_SUCCESS 0
11 | #define BS_INVALID -1
12 | // 没有达到所需结果,但无需处理,不是错误
13 | #define BS_NOMATTER -2
14 | // 等待结果中,尚未出错
15 | #define BS_WAITING -3
16 |
17 | // 文件相关
18 | #define BS_NOTFOUND -10
19 | #define BS_HASEXIST -11
20 | #define BS_CREATERR -12
21 |
22 | // 内存相关
23 | #define BS_NOMEM -22
24 | #define BS_NOBUFFER -23
25 |
26 | // 参数相关
27 | #define BS_PARAERR -31
28 | #define BS_PARANULL -32
29 | #define BS_JSONPARSE -33
30 |
31 | // 通信相关
32 | #define BS_HOSTERR -41
33 | #define BS_SOCKERR -42
34 | #define BS_STREAMERR -43
35 | #define BS_EPOLLERR -44
36 | #define BS_TIMEOUT -45
37 | #define BS_CONNERR -46
38 | #define BS_SENDERR -47
39 | #define BS_RECVERR -48
40 |
41 | // 进程相关
42 | #define BS_PROCERR -51
43 | #define BS_PROCSHUT -52
44 |
45 | // 权限相关
46 | #define BS_AUTHORITY -61
47 |
48 | // 数据库相关
49 | #define BS_DBERR -71
50 |
51 | // 容量相关
52 | #define BS_FULL -81
53 | #define BS_EMPTY -82
54 | #define BS_CROSSBORDER -83
55 |
56 | // 环境相关
57 | #define BS_ENVIERR -91
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/src/bs/bs_file.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_file.h
3 | * author : Rex
4 | * create : 2018-11-04 13:20
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __BS_FILE_H_
10 | #define __BS_FILE_H_
11 |
12 | #include
13 | #include "bs_type.h"
14 | #include "bs_object.h"
15 |
16 | #ifdef __cplusplus
17 | extern "C"{
18 | #endif
19 |
20 | typedef struct {
21 | object_t base;
22 | char folder[1024];
23 | char file[1024];
24 | char* buffer;
25 | uint32_t size;
26 | }folder_t;
27 |
28 | void* folder_init(void* p);
29 | void folder_destroy(void* p);
30 |
31 | status_t folder_open(folder_t* f, const char* folder);
32 | const char* folder_type(folder_t* f, const char* type);
33 | const char* folder_read(folder_t* f, const char* file);
34 | const char* folder_read_file(folder_t* f, const char* file);
35 |
36 | #ifdef __cplusplus
37 | }
38 | #endif
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/bs/bs_lock.c:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_lock.c
3 | * author : bushaofeng
4 | * create : 2013-11-19 23:06
5 | * func :
6 | */
7 |
8 | #include "bs_lock.h"
9 | #include "bs_timer.h"
10 |
11 | // 如果申请不到锁的等待时间
12 | static struct timeval g_wait_interval = {0, 5000};
13 |
14 | void bs_lock_init(bs_lock_t* lock){
15 | assert(lock!=NULL);
16 | *lock = 0;
17 | }
18 |
19 | void bs_rdlock(bs_lock_t* lock){
20 | assert(lock!=NULL);
21 | while(*lock < 0){
22 | bs_timer_sleep(&g_wait_interval);
23 | }
24 | (*lock)++;
25 | }
26 |
27 | state_t bs_rdlock_try(bs_lock_t* lock){
28 | if (lock==NULL || *lock<0) {
29 | return BS_INVALID;
30 | }
31 | (*lock)++;
32 | return BS_SUCCESS;
33 | }
34 |
35 | state_t bs_rdlock_unlock(bs_lock_t* lock){
36 | assert(lock!=NULL);
37 | return --(*lock)>=0;
38 | }
39 |
40 | void bs_wrlock(bs_lock_t* lock){
41 | assert(lock!=NULL);
42 |
43 | while(*lock!=0){
44 | bs_timer_sleep(&g_wait_interval);
45 | }
46 | //fprintf(stdout, "lock: %s", s);
47 | *lock = -1;
48 | }
49 |
50 | state_t bs_wrlock_try(bs_lock_t* lock){
51 | if (lock==NULL || *lock!=0) {
52 | return BS_INVALID;
53 | }
54 | *lock = -1;
55 | return BS_SUCCESS;
56 | }
57 |
58 | void bs_wrlock_unlock(bs_lock_t* lock){
59 | assert(lock!=NULL);
60 | //fprintf(stdout, "unlock: %s", s);
61 | *lock = 0;
62 | }
63 |
--------------------------------------------------------------------------------
/src/bs/bs_lock.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_lock.h
3 | * author : bushaofeng
4 | * create : 2013-11-19 23:00
5 | * func :
6 | */
7 |
8 | #ifndef __BS_LOCK_H_
9 | #define __BS_LOCK_H_
10 |
11 | #include "bs_type.h"
12 | #include "bs_error.h"
13 |
14 | #ifdef __cplusplus
15 | extern "C"{
16 | #endif
17 |
18 | typedef int bs_lock_t;
19 |
20 | #define SPINLOCK_INIT(lock) ((lock)=0)
21 | #define SPINLOCK_LOCK(lock) while(++lock>1){ \
22 | --lock; \
23 | }
24 | #define SPINLOCK_TRYLOCK(lock) (++lock==1 ? BS_SUCCESS:(--lock))
25 | #define SPINLOCK_UNLOCK(lock) (--lock)
26 |
27 | void bs_lock_init(bs_lock_t* lock);
28 | void bs_rdlock(bs_lock_t* lock);
29 | state_t bs_rdlock_try(bs_lock_t* lock);
30 | state_t bs_rdlock_unlock(bs_lock_t* lock);
31 |
32 | void bs_wrlock(bs_lock_t* lock);
33 | state_t bs_wrlock_try(bs_lock_t* lock);
34 | void bs_wrlock_unlock(bs_lock_t* lock);
35 |
36 |
37 | #ifdef __cplusplus
38 | }
39 | #endif
40 | #endif
41 |
--------------------------------------------------------------------------------
/src/bs/bs_mmap.c:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofeng. 2011.7.18
3 | * bs_mmap.c
4 | * history:
5 | */
6 |
7 | #include "bs_mmap.h"
8 |
9 | void* bs_mmap_create(int size){
10 | int fd;
11 | void* pmmap;
12 |
13 | fd = open("/dev/zero", O_RDWR);
14 | if(fd < 0){
15 | return NULL;
16 | }
17 |
18 | pmmap = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
19 | close(fd);
20 |
21 | if(pmmap == MAP_FAILED){
22 | return NULL;
23 | }
24 |
25 | return pmmap;
26 | }
27 |
28 | void* bs_mmap_file(char* file, size_t size){
29 | int fd;
30 | void* pmmap;
31 |
32 | fd = open(file , O_RDWR|O_CREAT);
33 | if(fd < 0){
34 | return NULL;
35 | }
36 |
37 | pmmap = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
38 | close(fd);
39 |
40 | if(pmmap == MAP_FAILED){
41 | return NULL;
42 | }
43 |
44 | return pmmap;
45 | }
46 |
--------------------------------------------------------------------------------
/src/bs/bs_mmap.h:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofeng. 2011.8.17
3 | * bs_mmap.c
4 | * history:
5 | */
6 |
7 | #ifndef BS_MMAP_H_
8 | #define BS_MMAP_H_
9 |
10 | #include "bs_type.h"
11 | #include "bs_error.h"
12 | #include "bs_def.h"
13 |
14 | #ifdef __cplusplus
15 | extern "C"{
16 | #endif
17 |
18 | void* bs_mmap_create(int size);
19 | void* bs_mmap_file(char* file, size_t size);
20 |
21 | #ifdef __cplusplus
22 | }
23 | #endif
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/src/bs/bs_object.c:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_object.c
3 | * author : bushaofeng
4 | * create : 2016-08-25 13:22
5 | * func :
6 | * history:
7 | */
8 |
9 | #include "bs_object.h"
10 |
11 | void* new_object(const char* name, uint32_t esize, void* (*constructor)(void*), void (*destructor)(void*)){
12 | object_t* object = (object_t*)malloc(esize);
13 | if (object==NULL)
14 | {
15 | return NULL;
16 | }
17 |
18 | memset(object, 0, esize);
19 | object->size = esize;
20 | memcpy(object->name, name, OBJECT_NAME_SIZE);
21 | object->constructor = constructor;
22 | object->destructor = destructor;
23 |
24 | constructor(object);
25 | object->dynamic = BS_TRUE;
26 | return object;
27 | }
28 |
--------------------------------------------------------------------------------
/src/bs/bs_object.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_object.h
3 | * author : bushaofeng
4 | * create : 2016-08-25 13:22
5 | * func : c语言实现面向对象
6 | * history:
7 | */
8 |
9 | #ifndef __BS_OBJECT_H_
10 | #define __BS_OBJECT_H_
11 |
12 | #include "bs_type.h"
13 | #include "bs_error.h"
14 | #ifdef __cplusplus
15 | extern "C"{
16 | #endif
17 |
18 | #define OBJECT_NAME_SIZE 64
19 |
20 | typedef struct object_t{
21 | bool_t dynamic:1; // 是否动态申请,在各个子类的init函数需要将object base设置为0
22 | uint32_t size:31;
23 | char name[OBJECT_NAME_SIZE];
24 | // 构造函数
25 | void* (*constructor)(void*);
26 | // 析构函数
27 | void (*destructor)(void*);
28 | }object_t;
29 |
30 | /// 创建一个对象
31 | void* new_object(const char* name, uint32_t esize, void* (*constructor)(void*), void (*destructor)(void*));
32 |
33 | /// 创建一个对象
34 | #define bs_new(type) ((type##_t*)new_object(#type, sizeof(type##_t), type##_init, type##_destroy))
35 |
36 | #define bs_init(obj, type) do{ \
37 | memset(obj, 0, sizeof(type##_t)); \
38 | type##_init(obj); \
39 | }while(0)
40 |
41 | /// 销毁对象
42 | #define bs_delete(o) do{ \
43 | ((object_t*)(o))->destructor(o); \
44 | if(((object_t*)(o))->dynamic) free(o); \
45 | }while(0)
46 |
47 | /// 对象类型名
48 | #define typename(o) ((object_t*)(o))->name
49 |
50 | #ifdef __cplusplus
51 | }
52 | #endif
53 | #endif
54 |
--------------------------------------------------------------------------------
/src/bs/bs_pool.c:
--------------------------------------------------------------------------------
1 | #include "bs_pool.h"
2 | #include "bs_mmap.h"
3 |
4 | state_t bs_pool_init(_pool_t* pool, uint32_t size, uint32_t esize, bool_t islock){
5 | state_t st;
6 | /*
7 | int i;
8 | _pool_head_t* curr;
9 | _pool_head_t* next;
10 | */
11 |
12 | assert(pool!=NULL && size>0 && esize>0);
13 | st = vector_init(&pool->buf);
14 | if(st!=BS_SUCCESS){
15 | return st;
16 | }
17 |
18 | pool->used_cnt = 0;
19 | pool->unused = NULL;
20 |
21 | return BS_SUCCESS;
22 | }
23 |
24 | void* bs_pool_malloc(_pool_t* pool){
25 | void* ptr = NULL;
26 |
27 | assert(pool != NULL);
28 | if(pool->unused != NULL){
29 | // ptr = pool->unused+1;
30 | // memset(ptr, 0, vector_esize(&pool->buf)-sizeof(_pool_head_t));
31 | // pool->unused = pool->unused->next;
32 | // pool->used_cnt++;
33 | // pool->unused_cnt--;
34 | }
35 | else{
36 | // ptr = vector_getback(&pool->buf);
37 | // if(ptr!=NULL){
38 | // ptr = (char*)ptr + sizeof(_pool_head_t);
39 | // pool->used_cnt++;
40 | // }
41 | }
42 |
43 | return ptr;
44 | }
45 |
46 | void bs_pool_free(_pool_t* pool, void* mem){
47 | assert(pool != NULL && mem != NULL);
48 | _pool_head_t* head = (_pool_head_t*)mem - 1;
49 | head->next = pool->unused;
50 | pool->unused = head;
51 | pool->used_cnt--;
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/src/bs/bs_sign.h:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofeng. 2012.3.17
3 | */
4 |
5 | #ifndef __BS_SIGN_H_
6 | #define __BS_SIGN_H_
7 |
8 | #include "bs_type.h"
9 | #include "bs_error.h"
10 |
11 | #ifdef __cplusplus
12 | extern "C"{
13 | #endif
14 |
15 | #define BS_MD5_STRLEN 32
16 |
17 | /*
18 | typedef struct{
19 | uint16_t sign1;
20 | unsigned char sign2[BS_MD5_STRLEN-sizeof(uint16_t)];
21 | }bs_sign_t;
22 | */
23 | typedef char bs_sign_t[BS_MD5_STRLEN+1];
24 |
25 | uint32_t bs_crc32(uint32_t crc, void* buf, uint32_t size);
26 | int bs_sign(char* buf, bs_sign_t sign);
27 | uint64_t bs_usign(char* buf);
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/bs/bs_string.c:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_string.c
3 | * author : bushaofeng
4 | * create : 2016-08-25 01:03
5 | * func :
6 | * history:
7 | */
8 |
9 | #include "bs_string.h"
10 |
11 | void* string_init(void* p){
12 | string_t* s = (string_t*)p;
13 | s->mem = (char*)malloc(STRING_DEF_SIZE);
14 | s->size = STRING_DEF_SIZE;
15 | s->len = 0;
16 | s->set = string_set;
17 | s->append = string_append;
18 | return s;
19 | }
20 |
21 | void string_destroy(void* p){
22 | string_t* s = (string_t*)p;
23 | if (s->mem != NULL)
24 | {
25 | free(s->mem);
26 | }
27 | s->mem = NULL;
28 | s->size = 0;
29 | }
30 |
31 | status_t string_set(struct string_t* str, const char* s){
32 | if (s==NULL) {
33 | return 0;
34 | }
35 |
36 | size_t len = strlen(s);
37 | if (str->size <= len) {
38 | size_t relen = len+1; // 如果len=1,需要额外加1个字节,所有后面+1
39 | // realloc: 如果有足够连续空间,直接在当前指针上扩展空间,如果不足则重新申请空间,同时会释放原空间
40 | char* pnew = (char*)realloc(str->mem, relen);
41 | if (pnew==NULL)
42 | {
43 | return BS_NOMEM;
44 | }
45 |
46 | str->mem = pnew;
47 | str->size = (uint32_t)relen;
48 | }
49 | strcpy(str->mem, s);
50 |
51 | return (int)len;
52 | }
53 |
54 | status_t string_append(string_t* str, const char* s){
55 | size_t len = strlen(s);
56 | if (str->size <= str->len+len)
57 | {
58 | size_t relen = len*3/2+1; // 如果len=1,需要额外加1个字节,所有后面+1
59 | // realloc: 如果有足够连续空间,直接在当前指针上扩展空间,如果不足则重新申请空间,同时会释放原空间
60 | char* pnew = (char*)realloc(str->mem, str->size + relen);
61 | if (pnew==NULL)
62 | {
63 | return BS_NOMEM;
64 | }
65 |
66 | str->mem = pnew;
67 | str->size += relen;
68 | }
69 | strcpy(str->mem+str->len, s);
70 | str->len += len;
71 |
72 | return str->len;
73 | }
74 |
--------------------------------------------------------------------------------
/src/bs/bs_string.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_string.h
3 | * author : bushaofeng
4 | * create : 2016-08-25 01:03
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __BS_STRING_H_
10 | #define __BS_STRING_H_
11 |
12 | #include "bs_type.h"
13 | #include "bs_error.h"
14 | #include "bs_object.h"
15 |
16 | #ifdef __cplusplus
17 | extern "C"{
18 | #endif
19 |
20 | #define STRING_DEF_SIZE 64
21 |
22 | typedef struct string_t{
23 | object_t base;
24 | uint32_t size;
25 | uint32_t len;
26 | char* mem;
27 | status_t (*set)(struct string_t* str, const char* s);
28 | status_t (*append)(struct string_t* str, const char* s);
29 | }string_t;
30 |
31 | void* string_init(void* p);
32 | void string_destroy(void* p);
33 | status_t string_set(struct string_t* str, const char* s);
34 | status_t string_append(string_t* str, const char* s);
35 |
36 | #define string_memory(s) ((s)->mem)
37 | // 内容长度,data的长度用size,string的长度用length
38 | #define string_size(s) ((s)->len)
39 |
40 | #define string_char(s) ((s)->mem)
41 | #define string_len(s) ((s)->len)
42 | #define string_substr(s, i) ((s)->mem+i)
43 |
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 | #endif
48 |
--------------------------------------------------------------------------------
/src/bs/ios.mk:
--------------------------------------------------------------------------------
1 | #DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/
2 | DEVROOT=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
3 | CC=$(DEVROOT)/usr/bin/clang -arch $(instruction)
4 | PP=$(DEVROOT)/usr/bin/clang++ -arch $(instruction)
5 | #SDKROOT=$(DEVROOT)/SDKs/iPhoneOS6.1.sdk
6 | SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
7 | LDFLAGS=-L$(SDKROOT)/usr/lib/system --sysroot=$(SDKROOT)
8 |
--------------------------------------------------------------------------------
/src/bs/linux.mk:
--------------------------------------------------------------------------------
1 | CC=gcc
2 | PP=g++
3 | LIB=-lpthread
4 |
--------------------------------------------------------------------------------
/src/bs/mac.mk:
--------------------------------------------------------------------------------
1 | DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/
2 | CC=/usr/bin/gcc
3 | PP=/usr/bin/g++
4 | SDKROOT=$(DEVROOT)/SDKs/MacOSX10.10.sdk
5 | LDFLAGS=-L$(SDKROOT)/usr/lib/system --sysroot=$(SDKROOT)
6 |
--------------------------------------------------------------------------------
/src/filter/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/filter/.DS_Store
--------------------------------------------------------------------------------
/src/filter/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_CFLAGS += -D__ANDROID__ -g
5 | #APP_PLATFORM := android-19
6 |
7 | LOCAL_C_INCLUDES := \
8 | $(LOCAL_PATH)/../base \
9 | $(LOCAL_PATH)/../base/android \
10 | $(LOCAL_PATH)/../filter \
11 | $(LOCAL_PATH)/../bs
12 |
13 | SRCFILES = $(wildcard $(LOCAL_PATH)/*.cpp $(LOCAL_PATH)/*/*.cpp)
14 | SRCS = $(patsubst $(LOCAL_PATH)/%, ./%,$(SRCFILES))
15 |
16 | LOCAL_SRC_FILES += $(SRCS)
17 | # GPUBackgroundFilter.cpp \
18 | # GPUGaussianBlurFilter.cpp \
19 | # GPUMedianFilter.cpp \
20 | # GPUSaturationFilter.cpp \
21 | # GPULuminanceFilter.cpp \
22 | # GPUOutlineFilter.cpp \
23 | # GPUSobelEdgeFilter.cpp
24 | #LOCAL_SRC_FILES := $(wildcard ./*.cpp)
25 |
26 | LOCAL_MODULE := filter
27 |
28 | include $(BUILD_STATIC_LIBRARY)
29 |
--------------------------------------------------------------------------------
/src/filter/GPUBezierFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBezierFilter.h
3 | * author : Rex
4 | * create : 2017-05-22 16:50
5 | * func : 贝塞尔曲线
6 | * history:
7 | */
8 |
9 | #ifndef __GPUBEZIERFILTER_H_
10 | #define __GPUBEZIERFILTER_H_
11 |
12 | #include "GPULineFilter.h"
13 |
14 | // 三点贝塞尔曲线
15 | class GPUBezierFilter: public GPULineFilter{
16 | public:
17 | GPUBezierFilter(int w=720, int h=1280):GPULineFilter(w, h){};
18 | // 此处p1不是控制点,是要经过的点,利用三点猜测控制点坐标
19 | GPUBezierFilter(gpu_point_t p0, gpu_point_t p1, gpu_point_t p2);
20 |
21 | // 贝塞尔曲线的3个端点,p1不是控制点,是要经过的点,利用三点猜测控制点坐标
22 | void setPoints(gpu_point_t p0, gpu_point_t p1, gpu_point_t p2);
23 | // 穿过多个点画曲线
24 | virtual void setPoints(gpu_point_t* points, int n);
25 | // 从c0-c1,颜色渐变
26 | void setColors(gpu_colorf_t c0, gpu_colorf_t c1);
27 |
28 | protected:
29 | void calSegmentPoints(gpu_point_t p0, gpu_point_t p1, gpu_point_t p2, std::vector& segments);
30 |
31 | gpu_point_t m_vertex_points[3]; // 贝塞尔曲线的3个端点
32 |
33 | gpu_point_t m_control_point;
34 | uint32_t m_segment;
35 | };
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/src/filter/GPUBilateralBlurFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBilateralBlurFilter.h
3 | * author : Rex
4 | * create : 2017-05-26 10:34
5 | * func : 平滑滤镜
6 | * history:
7 | */
8 |
9 | #ifndef __GPUBILATERALBLURFILTER_H_
10 | #define __GPUBILATERALBLURFILTER_H_
11 |
12 | #include "GPUTwoPassFilter.h"
13 |
14 | class GPUBilateralBlurFilter: public GPUTwoPassFilter{
15 | public:
16 | GPUBilateralBlurFilter();
17 |
18 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
19 | virtual void setExtraParameter(float strength);
20 | protected:
21 |
22 | };
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/src/filter/GPUBlankFilter.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBlankFilter.cpp
3 | * author : Rex
4 | * create : 2018-09-07 22:19
5 | * func :
6 | * history:
7 | */
8 |
9 | #include "GPUBlankFilter.h"
10 |
11 | void GPUBlankFilter::setStreamFrameSize(int width, int height){
12 | if(m_fill_mode != GPUFillModePreserveAspectRatio){
13 | setFillMode(GPUFillModePreserveAspectRatioAndFill);
14 | }
15 | setOutputSize(width, height);
16 | if(m_border > 0 && m_frame_width>0 && m_frame_height>0){
17 | float wf = m_border / m_frame_width;
18 | float hf = m_border / m_frame_height;
19 | float* v = getVertices();
20 | v[0] += wf;
21 | v[1] += hf;
22 | v[2] -= wf;
23 | v[3] += hf;
24 | v[4] += wf;
25 | v[5] -= hf;
26 | v[6] -= wf;
27 | v[7] -= hf;
28 | }
29 | }
30 |
31 | void GPUBlankFilter::setBlank(int border, int r, int g, int b){
32 | m_border = border;
33 | if(border==0){
34 | setFillMode(GPUFillModePreserveAspectRatioAndFill);
35 | return;
36 | }
37 |
38 | setFillMode(GPUFillModePreserveAspectRatio);
39 | if (m_frame_width>0 && m_frame_height>0){
40 | float wf = border*1.0f / m_frame_width;
41 | float hf = border*1.0f / m_frame_height;
42 | float* v = getVertices();
43 | v[0] += wf;
44 | v[1] += hf;
45 | v[2] -= wf;
46 | v[3] += hf;
47 | v[4] += wf;
48 | v[5] -= hf;
49 | v[6] -= wf;
50 | v[7] -= hf;
51 | }
52 |
53 | setClearColor(r/255.0f, g/255.0f, b/255.0f);
54 | }
55 |
--------------------------------------------------------------------------------
/src/filter/GPUBlankFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBlankFilter.h
3 | * author : Rex
4 | * create : 2018-09-07 22:18
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUBLANKFILTER_H_
10 | #define __GPUBLANKFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUBlankFilter: public GPUFilter{
15 | public:
16 | GPUBlankFilter(){
17 | m_border = 0;
18 | }
19 | void setStreamFrameSize(int width, int height);
20 | void setBlank(int border, int r, int g, int b);
21 |
22 | protected:
23 | int m_border;
24 | };
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/src/filter/GPUBlend2Filter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBlend2Filter.h
3 | * author : Rex
4 | * create : 2017-04-06 17:21
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUBLEND2FILTER_H_
10 | #define __GPUBLEND2FILTER_H_
11 |
12 | #include "GPUFilter.h"
13 | #include "GPUPicture.h"
14 |
15 | class GPUBlend2Filter: public GPUFilter{
16 | public:
17 | GPUBlend2Filter();
18 | ~GPUBlend2Filter();
19 |
20 | // 设置要进行blend的图片
21 | void setBlendImage(GPUPicture* image, gpu_rect_t rect, bool mirror);
22 | void setBlendImagePoints(GPUPicture* pic, gpu_point_t points[4], bool mirror);
23 | void setBlendPoints(gpu_point_t points[4], bool mirror);
24 | void removeBlendImage();
25 |
26 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location=0);
27 | virtual void setFrameSize(uint32_t width, uint32_t height);
28 | virtual void setOutputSize(uint32_t width, uint32_t height);
29 | virtual void render();
30 | protected:
31 |
32 | gpu_point_t m_points[4];
33 | bool m_mirror;
34 |
35 | float m_blend_coors[8]; // texture坐标
36 | GLint m_blend_coor;
37 | GPUVertexBuffer m_blend_buffer;
38 | GPUPicture* m_blend_pic;
39 | };
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/src/filter/GPUBlendImageFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBlendImageFilter.h
3 | * author : Rex
4 | * create : 2017-04-14 16:27
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUBLENDIMAGEFILTER_H_
10 | #define __GPUBLENDIMAGEFILTER_H_
11 |
12 | #include "GPUBlendFilter.h"
13 | #include "GPUPicture.h"
14 |
15 | class GPUBlendImageFilter: public GPUBlendFilter{
16 | public:
17 | GPUBlendImageFilter(int image_num=1);
18 | void setBlendImageRect(GPUPicture* pic, gpu_rect_t rect, int index=0);
19 | void setBlendImage(GPUPicture* pic, gpu_point_t points[4], int index=0);
20 |
21 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
22 | protected:
23 | std::vector m_images;
24 | };
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/src/filter/GPUColorFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUColorFilter.h
3 | * author : Rex
4 | * create : 2017-05-26 12:13
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUCONTRASTFILTER_H_
10 | #define __GPUCONTRASTFILTER_H_
11 |
12 | #include "GPUGroupFilter.h"
13 | #include "GPUGaussianBlurFilter.h"
14 |
15 | // 处理曝光、饱和、褪色、对比度
16 | class GPUColorShotFilter: public GPUFilter{
17 | public:
18 | GPUColorShotFilter();
19 |
20 |
21 | };
22 |
23 | // 处理模糊、锐化、色温、色调、高光、阴影、暗角
24 | class GPUColorAdjustFilter: public GPUFilter{
25 | public:
26 | GPUColorAdjustFilter();
27 |
28 | // 模糊
29 | };
30 |
31 | class GPUColorFilter: public GPUGroupFilter{
32 | public:
33 | GPUColorFilter();
34 |
35 | // 对比度 [-1, 1]
36 | void setContrast(float p);
37 | // 曝光度 [-1, 1]
38 | void setGamma(float p);
39 | // 饱和度 [-1, 1]
40 | void setSaturation(float p);
41 | // 褪色 [0, 1]
42 | void setFade(float p);
43 |
44 | // 设置模糊 [0, 1]
45 | void setBlur(float p);
46 | // 设置模糊范围
47 | void setUnBlurRegion(int x, int y, int radius);
48 | // 锐化 [0,1]
49 | void setSharpness(float p);
50 | // 色温 [-1,1]
51 | void setTemperature(float p);
52 | // 色调 [-1,1]
53 | void setTint(float p);
54 | // 高光 [0,1]
55 | void setHighlights(float p);
56 | // 阴影 [0,1]
57 | void setShadows(float p);
58 | // 暗角 [0,1]
59 | void setVignette(float intensity);
60 |
61 | public:
62 | GPUFilter m_shot_filter; // 处理曝光、饱和、褪色、对比度
63 | GPUFilter m_adjust_filter; // 处理模糊、锐化、色温、色调、高光、阴影、暗角
64 | GPUGaussianBlurFilter m_blur_filter;
65 | };
66 |
67 | #endif
68 |
--------------------------------------------------------------------------------
/src/filter/GPUGaussianBlurFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUGaussianBlurFilter.h
3 | * author : Rex
4 | * create : 2016-07-13 23:29
5 | * func : 高斯模糊
6 | * history:
7 | */
8 |
9 | #ifndef __GPUGAUSSIANBLURFILTER_H_
10 | #define __GPUGAUSSIANBLURFILTER_H_
11 |
12 | #include "GPUGroupFilter.h"
13 | #include "GPUMedianFilter.h"
14 |
15 | class GPUGaussianBlurFilter: public GPUGroupFilter{
16 | public:
17 | GPUGaussianBlurFilter(uint32_t radius=16, float sigma=2.0);
18 |
19 | virtual void setExtraParameter(float sigma);
20 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
21 |
22 | void setUnBlurRegion(int x, int y, int radius);
23 | protected:
24 | char* generateShader(uint32_t radius, float sigma);
25 | void setUnBlurRegion();
26 |
27 | char m_fragment[10240];
28 | int m_pixel_radius;
29 | int m_pixel_sigma;
30 |
31 | GPUFilter m_x_filter;
32 | GPUFilter m_y_filter;
33 |
34 | int m_unblur_x;
35 | int m_unblur_y;
36 | int m_unblur_radius;
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/filter/GPULookupFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPULookupFilter.h
3 | * author : Rex
4 | * create : 2018-07-14 22:59
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPULOOKUPFILTER_H_
10 | #define __GPULOOKUPFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 | #include "GPUPicture.h"
14 |
15 | class GPULookupFilter: public GPUFilter{
16 | public:
17 | GPULookupFilter(const char* path);
18 | ~GPULookupFilter();
19 | bool setLookupImage(const char* path);
20 | bool exist(){
21 | return m_lookup!=NULL;
22 | }
23 |
24 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
25 | virtual void setExtraParameter(float p);
26 |
27 | protected:
28 | GPUPicture* m_lookup;
29 | };
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/filter/GPULuminanceFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPULuminanceFilter.h
3 | * author : Rex
4 | * create : 2016-08-05 23:08
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPULUMINANCERANGEFILTER_H_
10 | #define __GPULUMINANCERANGEFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 | #include "GPUGroupFilter.h"
14 | #include "GPUGaussianBlurFilter.h"
15 | #include "GPUSaturationFilter.h"
16 |
17 | // 转灰度图
18 | class GPULuminanceFilter: public GPUFilter{
19 | public:
20 | GPULuminanceFilter();
21 | };
22 |
23 | class GPULuminanceRangeFilter: public GPUFilter{
24 | public:
25 | GPULuminanceRangeFilter(float rangeReduction = 0.6);
26 | virtual void setExtraParameter(float r);
27 | };
28 |
29 | class GPUExtraBlurFilter: public GPUGroupFilter{
30 | public:
31 | GPUExtraBlurFilter();
32 | virtual void setExtraParameter(float r);
33 | protected:
34 | GPUSaturationFilter m_saturation_filter;
35 | GPUGaussianBlurFilter m_gaussian_filter;
36 | GPULuminanceRangeFilter m_luminance_filter;
37 | };
38 | #endif
39 |
--------------------------------------------------------------------------------
/src/filter/GPUMedianFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUMedianFilter.h
3 | * author : Rex
4 | * create : 2016-08-05 15:05
5 | * func : 中值滤波
6 | * history:
7 | */
8 |
9 | #ifndef __GPUMEDIANFILTER_H_
10 | #define __GPUMEDIANFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUMedianFilter: public GPUFilter{
15 | public:
16 | GPUMedianFilter();
17 |
18 | virtual void setFrameSize(uint32_t width, uint32_t height);
19 | };
20 |
21 | class GPUMeansFilter: public GPUFilter{
22 | public:
23 | GPUMeansFilter();
24 |
25 | virtual void setFrameSize(uint32_t width, uint32_t height);
26 | };
27 |
28 | /*
29 | class GPUMedianFilter:public GPUTwoPassFilter{
30 | public:
31 | GPUMedianFilter(uint32_t distance = 2);
32 |
33 | void setPixelRadius(uint32_t distance);
34 |
35 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
36 |
37 | protected:
38 | char* generateShader(uint32_t distance);
39 |
40 | char m_fragment[10240];
41 |
42 | uint32_t m_frame_width;
43 | uint32_t m_frame_height;
44 | };
45 | */
46 | #endif
47 |
--------------------------------------------------------------------------------
/src/filter/GPUOutlineFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUOutlineFilter.h
3 | * author : Rex
4 | * create : 2016-08-16 20:08
5 | * func : 轮廓检测
6 | * history:
7 | */
8 |
9 | #ifndef __GPUOUTLINEFILTER_H_
10 | #define __GPUOUTLINEFILTER_H_
11 |
12 | #include "GPUSobelEdgeFilter.h"
13 | #include "GPUGroupFilter.h"
14 | #include "GPUGaussianBlurFilter.h"
15 |
16 | class GPUOutlineFilter: public GPUGroupFilter{
17 | public:
18 | GPUOutlineFilter();
19 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
20 |
21 | protected:
22 | GPUGaussianBlurFilter m_gaussian_filter;
23 | GPUSobelEdgeFilter m_sobel_filter;
24 | GPUFilter m_outline_filter;
25 |
26 | uint32_t m_frame_width;
27 | uint32_t m_frame_height;
28 | };
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/filter/GPUPaintFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUPaintFilter.h
3 | * author : Rex
4 | * create : 2017-05-23 13:25
5 | * func : 基于GPUBezierFilter画多段不连续曲线
6 | * history:
7 | */
8 |
9 | #ifndef __GPUPAINTFILTER_H_
10 | #define __GPUPAINTFILTER_H_
11 |
12 | #include "GPUBezierFilter.h"
13 |
14 | class GPUPaintFilter: public GPUFilter{
15 | public:
16 | GPUPaintFilter(int w=720, int h=1280);
17 | ~GPUPaintFilter();
18 |
19 | void clear();
20 | // 添加一条曲线
21 | void addPoints(gpu_point_t* points, int n);
22 |
23 | // c0-c1颜色渐变
24 | void setColors(gpu_colorf_t c0, gpu_colorf_t c1);
25 | void setLineWidth(uint32_t w){ m_line_width = w; }
26 |
27 | virtual void newFrame();
28 |
29 | protected:
30 | std::vector m_bezier_filters;
31 |
32 | gpu_colorf_t m_c0;
33 | gpu_colorf_t m_c1;
34 | uint32_t m_line_width;
35 | };
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/src/filter/GPUPixellateFilter.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // GPUPixellateFilter.cpp
3 | // libGPU
4 | //
5 | // Created by zhoubl on 2017/9/26.
6 | // Copyright © 2017年 Rex. All rights reserved.
7 | //
8 |
9 | #include "GPUPixellateFilter.h"
10 |
11 |
12 | const static char* g_mosaic_fragment_shader = SHADER_STRING (
13 | varying highp vec2 textureCoordinate;
14 |
15 | uniform sampler2D inputImageTexture;
16 |
17 | uniform highp float fractionalWidthOfPixel;
18 | uniform highp float aspectRatio;
19 |
20 | void main()
21 | {
22 | highp vec2 sampleDivisor = vec2(fractionalWidthOfPixel, fractionalWidthOfPixel / aspectRatio);
23 |
24 | highp vec2 samplePos = textureCoordinate - mod(textureCoordinate, sampleDivisor) + 0.5 * sampleDivisor;
25 | gl_FragColor = texture2D(inputImageTexture, samplePos );
26 | }
27 | );
28 |
29 | GPUPixellateFilter::GPUPixellateFilter(float blockSize, float ratio):GPUFilter(g_mosaic_fragment_shader) {
30 | setFloat("fractionalWidthOfPixel", blockSize);
31 | setFloat("aspectRatio", ratio);
32 | }
33 |
34 | void GPUPixellateFilter::setExtraParameter(float blockSize) {
35 | setFloat("fractionalWidthOfPixel", blockSize);
36 | }
37 |
--------------------------------------------------------------------------------
/src/filter/GPUPixellateFilter.h:
--------------------------------------------------------------------------------
1 | //
2 | // GPUPixellateFilter.hpp
3 | // libGPU
4 | //
5 | // Created by zhoubl on 2017/9/26.
6 | // Copyright © 2017年 Rex. All rights reserved.
7 | //
8 |
9 | #ifndef GPUPixellateFilter_hpp
10 | #define GPUPixellateFilter_hpp
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUPixellateFilter : public GPUFilter {
15 | public:
16 | GPUPixellateFilter(float blockSize = 0.05, float ratio = 1.33333);
17 | virtual void setExtraParameter(float blockSize);
18 | };
19 |
20 | #endif /* GPUPixellateFilter_hpp */
21 |
--------------------------------------------------------------------------------
/src/filter/GPUPixellatePositionFilter.h:
--------------------------------------------------------------------------------
1 | //
2 | // GPUPixellatePositionFilter.hpp
3 | // libGPU
4 | //
5 | // Created by zhoubl on 2017/9/25.
6 | // Copyright © 2017年 Rex. All rights reserved.
7 | //
8 |
9 | #ifndef GPUPixellatePositionFilter_hpp
10 | #define GPUPixellatePositionFilter_hpp
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUPixellatePositionFilter : public GPUFilter {
15 | public:
16 | GPUPixellatePositionFilter(float blockSize = 0.05, float ratio = 1.33333);
17 |
18 | virtual void setExtraParameter(float blockSize);
19 | void adjustPixellate(gpu_point_t center, float radius);
20 | };
21 | #endif /* GPUPixellatePositionFilter_hpp */
22 |
--------------------------------------------------------------------------------
/src/filter/GPUSaturationFilter.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUSaturationFilter.cpp
3 | * author : Rex
4 | * create : 2016-08-07 11:13
5 | * func :
6 | * history:
7 | */
8 |
9 | #include "GPUSaturationFilter.h"
10 |
11 | const static char* g_saturation_fragment_shader = SHADER_STRING
12 | (
13 | varying highp vec2 textureCoordinate;
14 |
15 | uniform sampler2D inputImageTexture[1];
16 | uniform lowp float saturation;
17 |
18 | // Values from "Graphics Shaders: Theory and Practice" by Bailey and Cunningham
19 | const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
20 |
21 | void main()
22 | {
23 | lowp vec4 textureColor = texture2D(inputImageTexture[0], textureCoordinate);
24 | lowp float luminance = dot(textureColor.rgb, luminanceWeighting);
25 | lowp vec3 greyScaleColor = vec3(luminance);
26 |
27 | gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);
28 |
29 | }
30 | );
31 |
32 | GPUSaturationFilter::GPUSaturationFilter(float sa):GPUFilter(g_saturation_fragment_shader){
33 | setExtraParameter(sa);
34 | }
35 |
36 | void GPUSaturationFilter::setExtraParameter(float saturation){
37 | setFloat("saturation", saturation);
38 | }
39 |
--------------------------------------------------------------------------------
/src/filter/GPUSaturationFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUSaturationFilter.h
3 | * author : Rex
4 | * create : 2016-08-07 11:12
5 | * func : 饱和度
6 | * history:
7 | */
8 |
9 | #ifndef __GPUSATURATIONFILTER_H_
10 | #define __GPUSATURATIONFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUSaturationFilter:public GPUFilter{
15 | public:
16 | GPUSaturationFilter(float m_saturation = 1.0f);
17 |
18 | virtual void setExtraParameter(float saturation);
19 | protected:
20 | float m_saturation;
21 | };
22 | #endif
23 |
--------------------------------------------------------------------------------
/src/filter/GPUSmoothFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUSmoothFilter.h
3 | * author : Rex
4 | * create : 2016-12-06 23:16
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUSMOOTHFILTER_H_
10 | #define __GPUSMOOTHFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUSmoothFilter: public GPUFilter{
15 | public:
16 | GPUSmoothFilter();
17 | virtual void setExtraParameter(float p);
18 | /// 0, 0.54, 0.69, 0.79, 0.90, 0.99分别对应0、1、2、3、4、5
19 | void setSmoothLevel(int level);
20 |
21 | protected:
22 | float m_strength;
23 | };
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/src/filter/GPUSobelEdgeFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUSobelEdgeFilter.h
3 | * author : Rex
4 | * create : 2016-08-10 20:57
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUSOBELEDGEFILTER_H_
10 | #define __GPUSOBELEDGEFILTER_H_
11 |
12 | #include "GPUTwoPassFilter.h"
13 | #include "GPULuminanceFilter.h"
14 |
15 | class GPUSobelEdgeFilter: public GPUTwoPassFilter{
16 | public:
17 | GPUSobelEdgeFilter(float strength = 1.0);
18 |
19 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
20 | virtual void setExtraParameter(float p);
21 | void setEdgeThreshold(float t);
22 |
23 | protected:
24 | uint32_t m_frame_width;
25 | uint32_t m_frame_height;
26 | };
27 |
28 | class GPUSobelDirectionFilter: public GPUFilter{
29 | public:
30 | GPUSobelDirectionFilter(float strength = 1.0);
31 |
32 | virtual void setExtraParameter(float p);
33 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
34 | };
35 |
36 | class GPUDirectionFilter: public GPUFilter{
37 | public:
38 | GPUDirectionFilter();
39 |
40 | virtual void setExtraParameter(float p);
41 | virtual void setFrameSize(uint32_t width, uint32_t height);
42 | };
43 |
44 | #pragma --mark "笔画细化"
45 | class GPUStrokeFilter: public GPUFilter{
46 | public:
47 | GPUStrokeFilter(int num = 1);
48 |
49 | virtual void setFrameSize(uint32_t width, uint32_t height);
50 | virtual void render();
51 |
52 | // 迭代次数
53 | virtual void setIterations(int num);
54 |
55 | protected:
56 | uint32_t m_iternum;
57 | };
58 | #endif
59 |
--------------------------------------------------------------------------------
/src/filter/GPUWhiteningFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUWhiteningFilter.h
3 | * author : Rex
4 | * create : 2016-12-06 23:32
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUWHITENINGFILTER_H_
10 | #define __GPUWHITENINGFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUWhiteningFilter: public GPUFilter{
15 | public:
16 | GPUWhiteningFilter(float s = 0);
17 |
18 | void setIdeal(float ideal[4]);
19 | void setThreshold(float thresh[4]);
20 | void setStrength(float s);
21 | protected:
22 | GLfloat m_idealpnts[8];
23 | GLfloat m_threshold[4];
24 | float m_strength;
25 |
26 | GLfloat m_rgb2yuv[9];
27 | GLfloat m_off2yuv[3];
28 | };
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/frame/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/frame/.DS_Store
--------------------------------------------------------------------------------
/src/frame/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_CFLAGS += -D__ANDROID__ -D__DEBUG__ -g
5 | #APP_PLATFORM := android-23
6 |
7 | LOCAL_C_INCLUDES := \
8 | $(LOCAL_PATH)/../base \
9 | $(LOCAL_PATH)/../base/android \
10 | $(LOCAL_PATH)/../filter \
11 | $(LOCAL_PATH)/../bs
12 |
13 | SRCFILES = $(wildcard $(LOCAL_PATH)/*.cpp $(LOCAL_PATH)/*/*.cpp)
14 | SRCS = $(patsubst $(LOCAL_PATH)/%, ./%,$(SRCFILES))
15 |
16 | LOCAL_SRC_FILES += $(SRCS)
17 |
18 | LOCAL_STATIC_LIBRARIES := \
19 | libfilter \
20 | libgpu \
21 | libbs
22 |
23 | LOCAL_SHARED_LIBRARIES := libnative
24 | LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog -lGLESv3 -lEGL -landroid -ljnigraphics
25 | LOCAL_MODULE := GPU
26 |
27 | include $(BUILD_SHARED_LIBRARY)
28 |
--------------------------------------------------------------------------------
/src/frame/android/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/frame/android/.DS_Store
--------------------------------------------------------------------------------
/src/frame/ios/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/frame/ios/.DS_Store
--------------------------------------------------------------------------------
/src/libGPU.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/libGPU.xcodeproj/project.xcworkspace/xcuserdata/Rex.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/libGPU.xcodeproj/project.xcworkspace/xcuserdata/Rex.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/src/libGPU.xcodeproj/project.xcworkspace/xcuserdata/Visionin.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/libGPU.xcodeproj/project.xcworkspace/xcuserdata/Visionin.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/src/libGPU.xcodeproj/xcuserdata/Rex.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | libGPU.xcscheme
8 |
9 | isShown
10 |
11 | orderHint
12 | 1
13 |
14 |
15 | SuppressBuildableAutocreation
16 |
17 | C8A0ACA31ECE9CE10043ADE9
18 |
19 | primary
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/libGPU.xcodeproj/xcuserdata/Visionin.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | libGPU.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | C8A0ACA31ECE9CE10043ADE9
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/output/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/output/.DS_Store
--------------------------------------------------------------------------------
/src/output/include/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neilcz/libGPU/38d5512eb888f2d69be0800220427c5539317ce2/src/output/include/.DS_Store
--------------------------------------------------------------------------------
/src/output/include/GPUBezierFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBezierFilter.h
3 | * author : Rex
4 | * create : 2017-05-22 16:50
5 | * func : 贝塞尔曲线
6 | * history:
7 | */
8 |
9 | #ifndef __GPUBEZIERFILTER_H_
10 | #define __GPUBEZIERFILTER_H_
11 |
12 | #include "GPULineFilter.h"
13 |
14 | // 三点贝塞尔曲线
15 | class GPUBezierFilter: public GPULineFilter{
16 | public:
17 | GPUBezierFilter(int w=720, int h=1280):GPULineFilter(w, h){};
18 | // 此处p1不是控制点,是要经过的点,利用三点猜测控制点坐标
19 | GPUBezierFilter(gpu_point_t p0, gpu_point_t p1, gpu_point_t p2);
20 |
21 | // 贝塞尔曲线的3个端点,p1不是控制点,是要经过的点,利用三点猜测控制点坐标
22 | void setPoints(gpu_point_t p0, gpu_point_t p1, gpu_point_t p2);
23 | // 穿过多个点画曲线
24 | virtual void setPoints(gpu_point_t* points, int n);
25 | // 从c0-c1,颜色渐变
26 | void setColors(gpu_colorf_t c0, gpu_colorf_t c1);
27 |
28 | protected:
29 | void calSegmentPoints(gpu_point_t p0, gpu_point_t p1, gpu_point_t p2, std::vector& segments);
30 |
31 | gpu_point_t m_vertex_points[3]; // 贝塞尔曲线的3个端点
32 |
33 | gpu_point_t m_control_point;
34 | uint32_t m_segment;
35 | };
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/src/output/include/GPUBilateralBlurFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBilateralBlurFilter.h
3 | * author : Rex
4 | * create : 2017-05-26 10:34
5 | * func : 平滑滤镜
6 | * history:
7 | */
8 |
9 | #ifndef __GPUBILATERALBLURFILTER_H_
10 | #define __GPUBILATERALBLURFILTER_H_
11 |
12 | #include "GPUTwoPassFilter.h"
13 |
14 | class GPUBilateralBlurFilter: public GPUTwoPassFilter{
15 | public:
16 | GPUBilateralBlurFilter();
17 |
18 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
19 | virtual void setExtraParameter(float strength);
20 | protected:
21 |
22 | };
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/src/output/include/GPUBlankFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBlankFilter.h
3 | * author : Rex
4 | * create : 2018-09-07 22:18
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUBLANKFILTER_H_
10 | #define __GPUBLANKFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUBlankFilter: public GPUFilter{
15 | public:
16 | GPUBlankFilter(){
17 | m_border = 0;
18 | }
19 | void setStreamFrameSize(int width, int height);
20 | void setBlank(int border, int r, int g, int b);
21 |
22 | protected:
23 | int m_border;
24 | };
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/src/output/include/GPUBlend2Filter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBlend2Filter.h
3 | * author : Rex
4 | * create : 2017-04-06 17:21
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUBLEND2FILTER_H_
10 | #define __GPUBLEND2FILTER_H_
11 |
12 | #include "GPUFilter.h"
13 | #include "GPUPicture.h"
14 |
15 | class GPUBlend2Filter: public GPUFilter{
16 | public:
17 | GPUBlend2Filter();
18 | ~GPUBlend2Filter();
19 |
20 | // 设置要进行blend的图片
21 | void setBlendImage(GPUPicture* image, gpu_rect_t rect, bool mirror);
22 | void setBlendImagePoints(GPUPicture* pic, gpu_point_t points[4], bool mirror);
23 | void setBlendPoints(gpu_point_t points[4], bool mirror);
24 | void removeBlendImage();
25 |
26 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location=0);
27 | virtual void setFrameSize(uint32_t width, uint32_t height);
28 | virtual void setOutputSize(uint32_t width, uint32_t height);
29 | virtual void render();
30 | protected:
31 |
32 | gpu_point_t m_points[4];
33 | bool m_mirror;
34 |
35 | float m_blend_coors[8]; // texture坐标
36 | GLint m_blend_coor;
37 | GPUVertexBuffer m_blend_buffer;
38 | GPUPicture* m_blend_pic;
39 | };
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/src/output/include/GPUBlendFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBlendFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-07-29 14:36
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUMBLENDFILTER_H_
11 | #define __GPUMBLENDFILTER_H_
12 |
13 | #include "GPUFilter.h"
14 | #include "GPUPicture.h"
15 |
16 | class GPUBlendFilter:public GPUFilter{
17 | public:
18 | GPUBlendFilter(int inputs=2);
19 | GPUBlendFilter(const char* fragment, int inputs=2);
20 | GPUBlendFilter(const char* vertex, const char* fragment, int inputs=2);
21 |
22 | virtual void newFrame();
23 |
24 | // 设置第几个texture的四角坐标,顺序 lt/rt/lb/rb
25 | void setDrawRect(gpu_point_t points[4], int i);
26 |
27 | const static int GPU_MUTABLE_TEXTURE_NUM = 8;
28 | const static char* g_mutable_vertext_shader;
29 | const static char* g_mutable_fragment_shader;
30 |
31 | protected:
32 | float m_coordinates[GPU_MUTABLE_TEXTURE_NUM][8]; // texture坐标
33 | };
34 | #endif
35 |
--------------------------------------------------------------------------------
/src/output/include/GPUBlendImageFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUBlendImageFilter.h
3 | * author : Rex
4 | * create : 2017-04-14 16:27
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUBLENDIMAGEFILTER_H_
10 | #define __GPUBLENDIMAGEFILTER_H_
11 |
12 | #include "GPUBlendFilter.h"
13 | #include "GPUPicture.h"
14 |
15 | class GPUBlendImageFilter: public GPUBlendFilter{
16 | public:
17 | GPUBlendImageFilter(int image_num=1);
18 | void setBlendImageRect(GPUPicture* pic, gpu_rect_t rect, int index=0);
19 | void setBlendImage(GPUPicture* pic, gpu_point_t points[4], int index=0);
20 |
21 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
22 | protected:
23 | std::vector m_images;
24 | };
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/src/output/include/GPUColorFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUColorFilter.h
3 | * author : Rex
4 | * create : 2017-05-26 12:13
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUCONTRASTFILTER_H_
10 | #define __GPUCONTRASTFILTER_H_
11 |
12 | #include "GPUGroupFilter.h"
13 | #include "GPUGaussianBlurFilter.h"
14 |
15 | // 处理曝光、饱和、褪色、对比度
16 | class GPUColorShotFilter: public GPUFilter{
17 | public:
18 | GPUColorShotFilter();
19 |
20 |
21 | };
22 |
23 | // 处理模糊、锐化、色温、色调、高光、阴影、暗角
24 | class GPUColorAdjustFilter: public GPUFilter{
25 | public:
26 | GPUColorAdjustFilter();
27 |
28 | // 模糊
29 | };
30 |
31 | class GPUColorFilter: public GPUGroupFilter{
32 | public:
33 | GPUColorFilter();
34 |
35 | // 对比度 [-1, 1]
36 | void setContrast(float p);
37 | // 曝光度 [-1, 1]
38 | void setGamma(float p);
39 | // 饱和度 [-1, 1]
40 | void setSaturation(float p);
41 | // 褪色 [0, 1]
42 | void setFade(float p);
43 |
44 | // 设置模糊 [0, 1]
45 | void setBlur(float p);
46 | // 设置模糊范围
47 | void setUnBlurRegion(int x, int y, int radius);
48 | // 锐化 [0,1]
49 | void setSharpness(float p);
50 | // 色温 [-1,1]
51 | void setTemperature(float p);
52 | // 色调 [-1,1]
53 | void setTint(float p);
54 | // 高光 [0,1]
55 | void setHighlights(float p);
56 | // 阴影 [0,1]
57 | void setShadows(float p);
58 | // 暗角 [0,1]
59 | void setVignette(float intensity);
60 |
61 | public:
62 | GPUFilter m_shot_filter; // 处理曝光、饱和、褪色、对比度
63 | GPUFilter m_adjust_filter; // 处理模糊、锐化、色温、色调、高光、阴影、暗角
64 | GPUGaussianBlurFilter m_blur_filter;
65 | };
66 |
67 | #endif
68 |
--------------------------------------------------------------------------------
/src/output/include/GPUFileFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUFileFilter.h
3 | * author : Rex
4 | * create : 2016-12-13 20:46
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUFILEFILTER_H_
10 | #define __GPUFILEFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 | #include "GPUPicture.h"
14 |
15 | extern const char* g_file_filter_map[];
16 | extern int g_file_filter_num;
17 |
18 | class GPUFileFilter: public GPUFilter{
19 | public:
20 | GPUFileFilter(const char* folder);
21 | ~GPUFileFilter();
22 |
23 | virtual void setInputFrameBuffer(GPUFrameBuffer* buffer, int location=0);
24 |
25 | bool exist(){ return m_exist; }
26 | protected:
27 | //用于查表的图片
28 | std::vector m_images;
29 | bool m_exist;
30 | };
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/src/output/include/GPUGaussianBlurFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUGaussianBlurFilter.h
3 | * author : Rex
4 | * create : 2016-07-13 23:29
5 | * func : 高斯模糊
6 | * history:
7 | */
8 |
9 | #ifndef __GPUGAUSSIANBLURFILTER_H_
10 | #define __GPUGAUSSIANBLURFILTER_H_
11 |
12 | #include "GPUGroupFilter.h"
13 | #include "GPUMedianFilter.h"
14 |
15 | class GPUGaussianBlurFilter: public GPUGroupFilter{
16 | public:
17 | GPUGaussianBlurFilter(uint32_t radius=16, float sigma=2.0);
18 |
19 | virtual void setExtraParameter(float sigma);
20 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
21 |
22 | void setUnBlurRegion(int x, int y, int radius);
23 | protected:
24 | char* generateShader(uint32_t radius, float sigma);
25 | void setUnBlurRegion();
26 |
27 | char m_fragment[10240];
28 | int m_pixel_radius;
29 | int m_pixel_sigma;
30 |
31 | GPUFilter m_x_filter;
32 | GPUFilter m_y_filter;
33 |
34 | int m_unblur_x;
35 | int m_unblur_y;
36 | int m_unblur_radius;
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/output/include/GPUGroupFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUGroupFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-08-06 21:57
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUGROUPFILTER_H_
11 | #define __GPUGROUPFILTER_H_
12 |
13 | #include "GPUFilter.h"
14 |
15 | class GPUGroupFilter: public GPUFilter{
16 | public:
17 | GPUGroupFilter(const char* name = NULL);
18 | virtual void newFrame();
19 | virtual void setInputFrameBuffer(GPUFrameBuffer* buffer, int location=0);
20 | virtual void setOutputRotation(gpu_rotation_t rotation);
21 |
22 | inline void setFirstFilter(GPUFilter* f){
23 | m_input = f;
24 | }
25 |
26 | inline void setLastFilter(GPUFilter* f){
27 | m_output = f;
28 | }
29 |
30 | inline GPUFilter* getFirstFilter(){ return m_input; }
31 | inline GPUFilter* getLastFilter(){ return m_output; }
32 |
33 | GPUFilter* m_input; // Group内第一个filter
34 | GPUFilter* m_output; // Group内最后一个filter
35 | };
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/src/output/include/GPUIOSBuffer.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUIOSBuffer.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-07-08 16:08
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUIOSBUFFER_H_
11 | #define __GPUIOSBUFFER_H_
12 |
13 | #import
14 | #import
15 | #import
16 | #include "GPUFrameBuffer.h"
17 |
18 | class GPUIOSFrameBuffer: public GPUFrameBuffer{
19 | public:
20 | GPUIOSFrameBuffer(gpu_size_t size, bool only_texture = true);
21 | GPUIOSFrameBuffer(int width, int height, bool only_texture = true);
22 | GPUIOSFrameBuffer(int width, int height, gpu_frame_option_t* option, bool only_texture = true);
23 | GPUIOSFrameBuffer(int width, int height, GLuint texture);
24 |
25 | virtual void generateFrameBuffer();
26 | CVPixelBufferRef getPixelBuffer(){
27 | return m_render_target;
28 | }
29 |
30 | ~GPUIOSFrameBuffer();
31 | protected:
32 |
33 | CVPixelBufferRef m_render_target;
34 | CVOpenGLESTextureRef m_render_texture;
35 | };
36 |
37 | class GPUIOSBufferCache:public GPUBufferCache{
38 | public:
39 | static GPUBufferCache* shareInstance();
40 | protected:
41 |
42 | virtual GPUFrameBuffer* newFrameBuffer(int width, int height, gpu_frame_option_t* option, bool only_texture=true);
43 | };
44 | #endif
45 |
--------------------------------------------------------------------------------
/src/output/include/GPULineFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPULineFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2017-05-19 15:17
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPULINEFILTER_H_
11 | #define __GPULINEFILTER_H_
12 |
13 | #include "GL.h"
14 | #include "GPUFilter.h"
15 |
16 | class GPULineFilter:public GPUFilter{
17 | public:
18 | GPULineFilter(int width=720, int height=1280);
19 |
20 | virtual void initShader();
21 | virtual void render();
22 |
23 | // 线段宽度,像素数
24 | void setLineWidth(uint32_t width);
25 | virtual void setPoints(gpu_point_t* points, int n);
26 | virtual void setColors(gpu_colorf_t* color, int n);
27 | virtual void setColor(gpu_colorf_t* color, int i);
28 |
29 | // 利用360个点画三角形形成圆
30 | void drawPoint(float x, float y, uint32_t radius, float* color);
31 | // 利用360个点和圆心画扇形形成圆
32 | void drawRound(float x, float y, uint32_t radius, float* color);
33 |
34 | protected:
35 | GLuint m_color;
36 | uint32_t m_line_width; // 线条宽度,像素宽度
37 |
38 | std::vector m_points;
39 | std::vector m_colors;
40 | uint32_t m_vertex_count;
41 | };
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/src/output/include/GPULookupFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPULookupFilter.h
3 | * author : Rex
4 | * create : 2018-07-14 22:59
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPULOOKUPFILTER_H_
10 | #define __GPULOOKUPFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 | #include "GPUPicture.h"
14 |
15 | class GPULookupFilter: public GPUFilter{
16 | public:
17 | GPULookupFilter(const char* path);
18 | ~GPULookupFilter();
19 | bool setLookupImage(const char* path);
20 | bool exist(){
21 | return m_lookup!=NULL;
22 | }
23 |
24 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
25 | virtual void setExtraParameter(float p);
26 |
27 | protected:
28 | GPUPicture* m_lookup;
29 | };
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/output/include/GPULuminanceFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPULuminanceFilter.h
3 | * author : Rex
4 | * create : 2016-08-05 23:08
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPULUMINANCERANGEFILTER_H_
10 | #define __GPULUMINANCERANGEFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 | #include "GPUGroupFilter.h"
14 | #include "GPUGaussianBlurFilter.h"
15 | #include "GPUSaturationFilter.h"
16 |
17 | // 转灰度图
18 | class GPULuminanceFilter: public GPUFilter{
19 | public:
20 | GPULuminanceFilter();
21 | };
22 |
23 | class GPULuminanceRangeFilter: public GPUFilter{
24 | public:
25 | GPULuminanceRangeFilter(float rangeReduction = 0.6);
26 | virtual void setExtraParameter(float r);
27 | };
28 |
29 | class GPUExtraBlurFilter: public GPUGroupFilter{
30 | public:
31 | GPUExtraBlurFilter();
32 | virtual void setExtraParameter(float r);
33 | protected:
34 | GPUSaturationFilter m_saturation_filter;
35 | GPUGaussianBlurFilter m_gaussian_filter;
36 | GPULuminanceRangeFilter m_luminance_filter;
37 | };
38 | #endif
39 |
--------------------------------------------------------------------------------
/src/output/include/GPUMedianFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUMedianFilter.h
3 | * author : Rex
4 | * create : 2016-08-05 15:05
5 | * func : 中值滤波
6 | * history:
7 | */
8 |
9 | #ifndef __GPUMEDIANFILTER_H_
10 | #define __GPUMEDIANFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUMedianFilter: public GPUFilter{
15 | public:
16 | GPUMedianFilter();
17 |
18 | virtual void setFrameSize(uint32_t width, uint32_t height);
19 | };
20 |
21 | class GPUMeansFilter: public GPUFilter{
22 | public:
23 | GPUMeansFilter();
24 |
25 | virtual void setFrameSize(uint32_t width, uint32_t height);
26 | };
27 |
28 | /*
29 | class GPUMedianFilter:public GPUTwoPassFilter{
30 | public:
31 | GPUMedianFilter(uint32_t distance = 2);
32 |
33 | void setPixelRadius(uint32_t distance);
34 |
35 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
36 |
37 | protected:
38 | char* generateShader(uint32_t distance);
39 |
40 | char m_fragment[10240];
41 |
42 | uint32_t m_frame_width;
43 | uint32_t m_frame_height;
44 | };
45 | */
46 | #endif
47 |
--------------------------------------------------------------------------------
/src/output/include/GPUOutlineFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUOutlineFilter.h
3 | * author : Rex
4 | * create : 2016-08-16 20:08
5 | * func : 轮廓检测
6 | * history:
7 | */
8 |
9 | #ifndef __GPUOUTLINEFILTER_H_
10 | #define __GPUOUTLINEFILTER_H_
11 |
12 | #include "GPUSobelEdgeFilter.h"
13 | #include "GPUGroupFilter.h"
14 | #include "GPUGaussianBlurFilter.h"
15 |
16 | class GPUOutlineFilter: public GPUGroupFilter{
17 | public:
18 | GPUOutlineFilter();
19 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
20 |
21 | protected:
22 | GPUGaussianBlurFilter m_gaussian_filter;
23 | GPUSobelEdgeFilter m_sobel_filter;
24 | GPUFilter m_outline_filter;
25 |
26 | uint32_t m_frame_width;
27 | uint32_t m_frame_height;
28 | };
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/output/include/GPUOutput.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUOutput.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-04-27 19:11
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUOUTPUT_H_
11 | #define __GPUOUTPUT_H_
12 |
13 | #include
14 | #include
15 | #include "GPUInput.h"
16 |
17 | using namespace std;
18 | class GPUOutput;
19 | typedef void (*GPUCompleteCallback_f)(GPUOutput *output, void *para);
20 |
21 | class GPUOutput {
22 | public:
23 | GPUOutput();
24 | ~GPUOutput() {
25 | reseto();
26 | }
27 |
28 | void reseto();
29 |
30 | /// 连接/删除(所有)下级连接
31 | virtual int addTarget(GPUInput *target, int location = 0);
32 | virtual bool removeTarget(GPUInput *target, int *location = NULL);
33 | virtual bool removeAllTargets();
34 | virtual void informTargets();
35 |
36 | int targetsCount();
37 | GPUInput* getTarget(int i, int &location);
38 |
39 | ///////////////////////////////////////////////////////
40 | /// 设置回调函数与回调参数
41 | void setCompleteCallback(GPUCompleteCallback_f complete, void* para);
42 |
43 | virtual void setOutputSize(uint32_t width, uint32_t height);
44 | gpu_size_t getOutputSize();
45 |
46 | GPUFrameBuffer* m_outbuffer;
47 | protected:
48 | std::vector m_targets;
49 | std::vector m_location;
50 |
51 | GPUCompleteCallback_f m_complete;
52 | void* m_para;
53 |
54 | // 输出尺寸
55 | uint32_t m_out_width;
56 | uint32_t m_out_height;
57 | };
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/src/output/include/GPUOutputFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUOutputFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2017-03-25 16:11
6 | * func : 输出group,支持bgra、rgba、nv12、nv21、i420等格式输出
7 | * history:
8 | */
9 |
10 | #ifndef __GPUOUTPUTFILTER_H_
11 | #define __GPUOUTPUTFILTER_H_
12 |
13 | #include "GPUGroupFilter.h"
14 | #include "GPUZoomFilter.h"
15 | #include "GPUYUVFilter.h"
16 | #include "GPUYUV420Filter.h"
17 | #include "GPURawOutput.h"
18 |
19 | class GPUOutputFilter: public GPUGroupFilter{
20 | public:
21 | GPUOutputFilter(gpu_pixel_format_t format);
22 |
23 | inline unsigned char* getBuffer(unsigned char* buffer = NULL, uint32_t size = 0){
24 | return m_raw_output.getBuffer(buffer, size);
25 | }
26 | protected:
27 | GPUZoomFilter m_zoom_filter;
28 | GPURGBToYUVFilter m_yuv_filter;
29 | GPUFilter* m_420_filter;
30 | GPURawOutput m_raw_output;
31 | };
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/output/include/GPUPaintFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUPaintFilter.h
3 | * author : Rex
4 | * create : 2017-05-23 13:25
5 | * func : 基于GPUBezierFilter画多段不连续曲线
6 | * history:
7 | */
8 |
9 | #ifndef __GPUPAINTFILTER_H_
10 | #define __GPUPAINTFILTER_H_
11 |
12 | #include "GPUBezierFilter.h"
13 |
14 | class GPUPaintFilter: public GPUFilter{
15 | public:
16 | GPUPaintFilter(int w=720, int h=1280);
17 | ~GPUPaintFilter();
18 |
19 | void clear();
20 | // 添加一条曲线
21 | void addPoints(gpu_point_t* points, int n);
22 |
23 | // c0-c1颜色渐变
24 | void setColors(gpu_colorf_t c0, gpu_colorf_t c1);
25 | void setLineWidth(uint32_t w){ m_line_width = w; }
26 |
27 | virtual void newFrame();
28 |
29 | protected:
30 | std::vector m_bezier_filters;
31 |
32 | gpu_colorf_t m_c0;
33 | gpu_colorf_t m_c1;
34 | uint32_t m_line_width;
35 | };
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/src/output/include/GPUPicture.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUPicture.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-08-10 17:06
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUPICTURE_H_
11 | #define __GPUPICTURE_H_
12 |
13 | #include "bs.h"
14 | #include "GPUOutput.h"
15 | #include "GPUFrameBuffer.h"
16 |
17 | class GPUPicture: public GPUOutput{
18 | public:
19 | GPUPicture(){
20 | m_option = GPUFrameBuffer::defaultFrameOption();
21 | }
22 | GPUPicture(const char* path);
23 | GPUPicture(uint8_t * data, uint32_t size);
24 | GPUPicture(uint8_t * data, int width, int height);
25 | GPUPicture(uint8_t * data, int width, int height, gpu_frame_option_t* option);
26 | #if __IOS__
27 | GPUPicture(void* cgImageRef);
28 | // pathForResource路径初始化
29 | GPUPicture(const char* file, const char* type);
30 | #endif
31 | #if __ANDROID__
32 | GPUPicture(jobject bitmap);
33 | #endif
34 | ~GPUPicture();
35 |
36 | bool load(const char* path);
37 | bool load(uint8_t * data, uint32_t size);
38 | virtual bool exist(){ return m_exist; }
39 | void processImage();
40 | void setPixel(uint8_t* pixels, uint32_t width, uint32_t height);
41 |
42 | gpu_frame_option_t m_option;
43 | uint8_t* m_pixels;
44 | gpu_size_t m_image_size;
45 | protected:
46 | #if __IOS__
47 | void init(void* image);
48 | #endif
49 |
50 | bool hasProcessedImage;
51 | bool m_exist;
52 | };
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/src/output/include/GPUPixelBuffer.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUPixelBuffer.h
3 | * author : Rex
4 | * create : 2016-07-21 16:58
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUPIXELBUFFER_H_
10 | #define __GPUPIXELBUFFER_H_
11 |
12 | #include "GPUContext.h"
13 | #include "GPUFrameBuffer.h"
14 |
15 | class GPUPixelBuffer{
16 | public:
17 | /**
18 | * @size: pbo大小,width*height, size*4为实际rgba容量
19 | * @sync: 为同步或者异步模式
20 | */
21 | GPUPixelBuffer(int size, bool sync = true, int elem_size=1);
22 | ~GPUPixelBuffer();
23 | void* read(GPUFrameBuffer* framebuffer);
24 | void unactive();
25 |
26 | inline void lock(){
27 | pthread_mutex_lock(&m_lock);
28 | }
29 | inline void unlock(){
30 | pthread_mutex_unlock(&m_lock);
31 | }
32 | protected:
33 | GPUFrameBuffer* m_frame_buffer;
34 | GLuint m_buffer[2];
35 | GLuint m_map_index;
36 | GLubyte* m_ptr;
37 |
38 | pthread_mutex_t m_lock;
39 | GLuint m_pack_mode;
40 | uint32_t m_size;
41 | bool m_sync; // 是否同步
42 | bool m_first; // 是否第一帧
43 | };
44 | #endif
45 |
--------------------------------------------------------------------------------
/src/output/include/GPUPixellateFilter.h:
--------------------------------------------------------------------------------
1 | //
2 | // GPUPixellateFilter.hpp
3 | // libGPU
4 | //
5 | // Created by zhoubl on 2017/9/26.
6 | // Copyright © 2017年 Rex. All rights reserved.
7 | //
8 |
9 | #ifndef GPUPixellateFilter_hpp
10 | #define GPUPixellateFilter_hpp
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUPixellateFilter : public GPUFilter {
15 | public:
16 | GPUPixellateFilter(float blockSize = 0.05, float ratio = 1.33333);
17 | virtual void setExtraParameter(float blockSize);
18 | };
19 |
20 | #endif /* GPUPixellateFilter_hpp */
21 |
--------------------------------------------------------------------------------
/src/output/include/GPUPixellatePositionFilter.h:
--------------------------------------------------------------------------------
1 | //
2 | // GPUPixellatePositionFilter.hpp
3 | // libGPU
4 | //
5 | // Created by zhoubl on 2017/9/25.
6 | // Copyright © 2017年 Rex. All rights reserved.
7 | //
8 |
9 | #ifndef GPUPixellatePositionFilter_hpp
10 | #define GPUPixellatePositionFilter_hpp
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUPixellatePositionFilter : public GPUFilter {
15 | public:
16 | GPUPixellatePositionFilter(float blockSize = 0.05, float ratio = 1.33333);
17 |
18 | virtual void setExtraParameter(float blockSize);
19 | void adjustPixellate(gpu_point_t center, float radius);
20 | };
21 | #endif /* GPUPixellatePositionFilter_hpp */
22 |
--------------------------------------------------------------------------------
/src/output/include/GPUProgram.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUProgram.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-05-09 22:30
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUPROGRAM_H_
11 | #define __GPUPROGRAM_H_
12 |
13 | #include "GL.h"
14 | #include "GPUContext.h"
15 |
16 | class GPUProgram{
17 | public:
18 | GPUProgram();
19 | GPUProgram(const char* vertex, const char* fragment, const char* filter = NULL);
20 | ~GPUProgram() {
21 | clearProgram();
22 | }
23 |
24 | GLint attributeIndex(const char* name);
25 | GLint uniformIndex(const char* name);
26 | void setUniformsIndex(const char* name, GLint* index, uint32_t size);
27 |
28 | void link();
29 | void use();
30 |
31 | GLuint getProgram(){
32 | return m_shader_program;
33 | }
34 |
35 | int setProgram(const char *fragment, const char *vertex = NULL);
36 |
37 | void setInteger(const char *name, int val);
38 | void setIntegerv(const char *name, int* val, int num);
39 | void setUIntegerv(const char *name, uint32_t* val, int num);
40 | void setFloat(const char* name, GLfloat val);
41 | void setFloat(const char* name, GLfloat* val, int num);
42 | void setFloatv(const char* name, GLfloat* val, int num);
43 | void setMatrix(const char* name, GLfloat* val, int num);
44 | void enableAttribArray(const char* name);
45 |
46 | const char* m_vertex_str;
47 | const char* m_fragment_str;
48 | const char* m_filter;
49 | protected:
50 | void compile(const char* vertex, const char* fragment);
51 | GLuint loadShader(GLenum shaderType, const char* pSource);
52 |
53 | protected:
54 | GLuint m_shader_program;
55 | GLuint m_vertex;
56 | GLuint m_fragment;
57 | bool m_shader_used;
58 |
59 | void clearProgram();
60 | };
61 |
62 | #endif
63 |
--------------------------------------------------------------------------------
/src/output/include/GPURawInput.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPURawInput.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-04-27 21:10
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPU_RAWINPUT_H_
11 | #define __GPU_RAWINPUT_H_
12 | #include "GPUContext.h"
13 | #include "GPUOutput.h"
14 | #include "GPUGroupFilter.h"
15 | #include "GPUYUVFilter.h"
16 |
17 | class GPURawInput: public GPUGroupFilter{
18 | public:
19 | GPURawInput(gpu_pixel_format_t format = GPU_RGBA);
20 | GPURawInput(int width, int height, gpu_pixel_format_t format = GPU_RGBA);
21 | ~GPURawInput();
22 |
23 | // m_width和m_height是输出尺寸,和此处width、height可能为旋转关系,注意区别
24 | void uploadBytes(GLubyte* bytes, int width, int height, gpu_pixel_format_t in_type = GPU_NV21);
25 | void uploadBytes(GLubyte* bytes);
26 |
27 | gpu_pixel_format_t getFormat(){
28 | return m_in_format;
29 | }
30 |
31 | protected:
32 | void setFormat(gpu_pixel_format_t format);
33 |
34 | gpu_pixel_format_t m_in_format;
35 | int m_width;
36 | int m_height;
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/output/include/GPURawOutput.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPURawOutput.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-06-01 14:41
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPURAWOUTPUT_H_
11 | #define __GPURAWOUTPUT_H_
12 |
13 | #include "GPUContext.h"
14 | #include "GPUFrameBuffer.h"
15 | #include "GPUInput.h"
16 |
17 | class GPURawOutput:public GPUInput{
18 | public:
19 | GPURawOutput(bool direct = false); // 默认直到获取buffer时候才从gpu中读取
20 | ~GPURawOutput();
21 | // 外部传入buffer
22 | void setBuffer(unsigned char* buffer, uint32_t size);
23 | // 从buffer中获取
24 | unsigned char * getBuffer(unsigned char* buffer = NULL, uint32_t size = 0);
25 | int getTexture();
26 | int getSize(){
27 | return m_size;
28 | }
29 |
30 | virtual void newFrame();
31 | virtual void setInputFrameBuffer(GPUFrameBuffer* buffer, int location=0);
32 |
33 | protected:
34 | GPUFrameBuffer* m_firstbuffer;
35 |
36 | unsigned char* m_bytebuffer;
37 | int m_size;
38 | bool m_direct;
39 | bool m_frame_get;
40 | };
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/src/output/include/GPUSampleBufferInput.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUSampleBufferInput.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2017-03-25 20:41
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUSAMPLEBUFFERINPUT_H_
11 | #define __GPUSAMPLEBUFFERINPUT_H_
12 |
13 | #include
14 | #include
15 | #include "GPU.h"
16 | #include "GPUGroupFilter.h"
17 | #include "GPUYUVFilter.h"
18 | #include "GPUIOSBuffer.h"
19 |
20 | class GPUSampleBufferInput: public GPUGroupFilter{
21 | public:
22 | GPUSampleBufferInput();
23 | ~GPUSampleBufferInput();
24 | // 视频流处理
25 | void processSampleBuffer(CMSampleBufferRef sampleBuffer);
26 | void processPixelBuffer(CVImageBufferRef pixelBuffer);
27 |
28 | GPUIOSFrameBuffer* m_rawbuffer;
29 | protected:
30 | OSType m_format; // 是否YUV数据
31 | };
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/output/include/GPUSaturationFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUSaturationFilter.h
3 | * author : Rex
4 | * create : 2016-08-07 11:12
5 | * func : 饱和度
6 | * history:
7 | */
8 |
9 | #ifndef __GPUSATURATIONFILTER_H_
10 | #define __GPUSATURATIONFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUSaturationFilter:public GPUFilter{
15 | public:
16 | GPUSaturationFilter(float m_saturation = 1.0f);
17 |
18 | virtual void setExtraParameter(float saturation);
19 | protected:
20 | float m_saturation;
21 | };
22 | #endif
23 |
--------------------------------------------------------------------------------
/src/output/include/GPUSmoothFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUSmoothFilter.h
3 | * author : Rex
4 | * create : 2016-12-06 23:16
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUSMOOTHFILTER_H_
10 | #define __GPUSMOOTHFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUSmoothFilter: public GPUFilter{
15 | public:
16 | GPUSmoothFilter();
17 | virtual void setExtraParameter(float p);
18 | /// 0, 0.54, 0.69, 0.79, 0.90, 0.99分别对应0、1、2、3、4、5
19 | void setSmoothLevel(int level);
20 |
21 | protected:
22 | float m_strength;
23 | };
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/src/output/include/GPUSobelEdgeFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUSobelEdgeFilter.h
3 | * author : Rex
4 | * create : 2016-08-10 20:57
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUSOBELEDGEFILTER_H_
10 | #define __GPUSOBELEDGEFILTER_H_
11 |
12 | #include "GPUTwoPassFilter.h"
13 | #include "GPULuminanceFilter.h"
14 |
15 | class GPUSobelEdgeFilter: public GPUTwoPassFilter{
16 | public:
17 | GPUSobelEdgeFilter(float strength = 1.0);
18 |
19 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
20 | virtual void setExtraParameter(float p);
21 | void setEdgeThreshold(float t);
22 |
23 | protected:
24 | uint32_t m_frame_width;
25 | uint32_t m_frame_height;
26 | };
27 |
28 | class GPUSobelDirectionFilter: public GPUFilter{
29 | public:
30 | GPUSobelDirectionFilter(float strength = 1.0);
31 |
32 | virtual void setExtraParameter(float p);
33 | virtual void setInputFrameBuffer(GPUFrameBuffer *buffer, int location = 0);
34 | };
35 |
36 | class GPUDirectionFilter: public GPUFilter{
37 | public:
38 | GPUDirectionFilter();
39 |
40 | virtual void setExtraParameter(float p);
41 | virtual void setFrameSize(uint32_t width, uint32_t height);
42 | };
43 |
44 | #pragma --mark "笔画细化"
45 | class GPUStrokeFilter: public GPUFilter{
46 | public:
47 | GPUStrokeFilter(int num = 1);
48 |
49 | virtual void setFrameSize(uint32_t width, uint32_t height);
50 | virtual void render();
51 |
52 | // 迭代次数
53 | virtual void setIterations(int num);
54 |
55 | protected:
56 | uint32_t m_iternum;
57 | };
58 | #endif
59 |
--------------------------------------------------------------------------------
/src/output/include/GPUTextureInput.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUTextureInput.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-12-08 15:39
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUTEXTUREINPUT_H_
11 | #define __GPUTEXTUREINPUT_H_
12 |
13 | #include "GPUContext.h"
14 | #include "GPUOutput.h"
15 | #include "GPUFilter.h"
16 |
17 | class GPUTextureInput: public GPUFilter {
18 | public:
19 | GPUTextureInput();
20 | GPUTextureInput(int width, int height, int texture_type = GPU_TEXTURE_OES);
21 | void processTexture();
22 | void processTexture(GLuint texture);
23 |
24 |
25 | /// void render();
26 | gpu_size_t getSize(){
27 | gpu_size_t size = {m_out_width, m_out_height};
28 | return size;
29 | }
30 | // 设置视频输出尺寸,可能和输入不一致,为旋转关系
31 | // void setOutputSize(int width, int height){
32 | // m_width = width;
33 | // m_height = height;
34 | // }
35 | virtual void render(); /// 重载父类函数,渲染流程,解锁输入
36 | protected:
37 | GLuint m_texture;
38 | int m_texture_type;
39 | /// int m_width, m_height;
40 | };
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/src/output/include/GPUTriangleFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUTriangleFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2017-02-25 23:32
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUTRIANGLEFILTER_H_
11 | #define __GPUTRIANGLEFILTER_H_
12 |
13 | #include "GPUFilter.h"
14 |
15 | class GPUTriangleFilter: public GPUFilter{
16 | public:
17 | GPUTriangleFilter(const char* fragment, int inputs=1, int vertex=4);
18 | void setVertex(float* vertex, int count);
19 |
20 | virtual void render();
21 | };
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/output/include/GPUTwoPassFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUTwoPassFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-05-05 19:49
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUTWOPASSFILTER_H_
11 | #define __GPUTWOPASSFILTER_H_
12 | #include "GPUFilter.h"
13 |
14 | class GPUTwoPassFilter: public GPUFilter{
15 | public:
16 | GPUTwoPassFilter();
17 | GPUTwoPassFilter(const char* first_fragment, const char* second_fragment);
18 | GPUTwoPassFilter(const char* first_vertext, const char* first_fragment, const char* second_vertext, const char* second_fragment);
19 |
20 | virtual ~GPUTwoPassFilter(){
21 | delete m_first_filter;
22 | m_first_filter = NULL;
23 | delete m_second_filter;
24 | m_second_filter = NULL;
25 | }
26 |
27 | virtual void init_filter();
28 | void render();
29 | virtual void setInputFrameBuffer(GPUFrameBuffer* buffer, int location=0);
30 | virtual void setOutputRotation(gpu_rotation_t rotation){
31 | m_rotation = rotation;
32 | m_first_filter->setOutputRotation(rotation);
33 | }
34 |
35 | // 修改shader
36 | void changeShader(const char* first_fragment, const char* second_fragment);
37 | protected:
38 | GPUFilter* m_first_filter;
39 | GPUFilter* m_second_filter;
40 | };
41 | #endif
42 |
--------------------------------------------------------------------------------
/src/output/include/GPUView.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : gpu_view.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-04-27 19:13
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPU_VIEW_H_
11 | #define __GPU_VIEW_H_
12 | #ifdef __ANDROID__
13 | #include
14 | #include
15 | #endif
16 | #include "GPUFilter.h"
17 |
18 | class GPUView: public GPUFilter{
19 | // class GPUView: public GPUFilter{
20 | public:
21 | GPUView(int width, int height);
22 | #ifdef __ANDROID__
23 | GPUView(ANativeWindow * surface);
24 | void setNativeWindow(ANativeWindow * surface);
25 | #endif
26 | ~GPUView();
27 |
28 | virtual void newFrame();
29 |
30 | protected:
31 | GLuint m_displaybuffer;
32 | GLuint m_displayrender;
33 |
34 | #ifdef __ANDROID__
35 | void createWindowContext();
36 |
37 | EGLSurface m_eglsurface;
38 | ANativeWindow* m_surface;
39 | #endif
40 | };
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/src/output/include/GPUWhiteningFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUWhiteningFilter.h
3 | * author : Rex
4 | * create : 2016-12-06 23:32
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __GPUWHITENINGFILTER_H_
10 | #define __GPUWHITENINGFILTER_H_
11 |
12 | #include "GPUFilter.h"
13 |
14 | class GPUWhiteningFilter: public GPUFilter{
15 | public:
16 | GPUWhiteningFilter(float s = 0);
17 |
18 | void setIdeal(float ideal[4]);
19 | void setThreshold(float thresh[4]);
20 | void setStrength(float s);
21 | protected:
22 | GLfloat m_idealpnts[8];
23 | GLfloat m_threshold[4];
24 | float m_strength;
25 |
26 | GLfloat m_rgb2yuv[9];
27 | GLfloat m_off2yuv[3];
28 | };
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/output/include/GPUZoomFilter.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : GPUZoomFilter.h
3 | * author : Rex
4 | * email : rex@labjk.com
5 | * create : 2016-07-12 20:33
6 | * func :
7 | * history:
8 | */
9 |
10 | #ifndef __GPUZOOMFILTER_H_
11 | #define __GPUZOOMFILTER_H_
12 |
13 | #include "GPUFilter.h"
14 |
15 | class GPUZoomFilter:public GPUFilter{
16 | public:
17 | GPUZoomFilter(gpu_fill_mode_t mode=GPUFillModePreserveAspectRatioAndFill);
18 | virtual void render();
19 | // 只支持RGBA和BGRA
20 | void setOutputFormat(gpu_pixel_format_t format);
21 | };
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/output/include/bs.h:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofeng. 2011.9.14
3 | * bs.h
4 | * history:
5 | */
6 |
7 | #ifndef __BS_H_
8 | #define __BS_H_
9 |
10 | #include "bs_type.h"
11 | #include "bs_error.h"
12 | #include "bs_def.h"
13 |
14 | #include "bs_mmap.h"
15 | #include "bs_conf.h"
16 | #include "bs_struct.h"
17 | #include "bs_log.h"
18 | #include "bs_common.h"
19 | #include "bs_sign.h"
20 | #include "bs_socket.h"
21 | #include "bs_pack.h"
22 | #include "bs_list.h"
23 | #include "bs_pool.h"
24 | #include "bs_vector.h"
25 | #include "bs_cqueue.h"
26 | #include "bs_timer.h"
27 | #include "bs_url.h"
28 | #include "bs_hashmap.h"
29 | #include "bs_object.h"
30 | #include "bs_string.h"
31 | #include "bs_data.h"
32 | #include "bs_file.h"
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/output/include/bs_data.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_data.h
3 | * author : Rex
4 | * create : 2016-11-15 17:53
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __BS_DATA_H_
10 | #define __BS_DATA_H_
11 |
12 | #include "bs_type.h"
13 | #include "bs_error.h"
14 | #include "bs_object.h"
15 |
16 | #ifdef __cplusplus
17 | extern "C"{
18 | #endif
19 |
20 | #define STRING_DEF_SIZE 64
21 |
22 | typedef struct data_t{
23 | object_t base;
24 | uint32_t size;
25 | uint32_t len;
26 | char* mem;
27 | status_t (*set)(struct data_t* str, const char* s, uint32_t size);
28 | status_t (*append)(struct data_t* str, const char* s, uint32_t size);
29 | }data_t;
30 |
31 | void* data_init(void* p);
32 | void data_destroy(void* p);
33 | status_t data_set(struct data_t* str, const char* s, uint32_t size);
34 | status_t data_append(data_t* str, const char* s, uint32_t size);
35 |
36 | #define data_memory(s) ((s)->mem)
37 | // 内容长度,data的长度用size,string的长度用length
38 | #define data_size(s) ((s)->len)
39 |
40 | #ifdef __cplusplus
41 | }
42 | #endif
43 | #endif
44 |
--------------------------------------------------------------------------------
/src/output/include/bs_def.h:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofeng. 2011.8.24
3 | * bs_define.h
4 | * history:
5 | */
6 |
7 | #ifndef __BS_DEF_H_
8 | #define __BS_DEF_H_
9 |
10 | #define BS_DEF_STRLEN 512
11 | #define BS_SHORT_STRLEN 64
12 | #define BS_LONG_STRLEN 1024
13 |
14 | #define BS_DEF_BUF_SIZE 256
15 |
16 | #define BS_DEF_ARYLEN 256
17 | #define BS_DEF_ADDLEN 128
18 | #define BS_LONG_ARYLEN 512
19 |
20 | #define BS_STREAM_BUFSIZE 1024000
21 |
22 | #define IP_SIZE 16
23 |
24 | #ifndef NULL
25 | #define NULL ((void*)0)
26 | #endif
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/src/output/include/bs_error.h:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofneg. 2011.8.24
3 | * bs_error.h
4 | * history:
5 | */
6 |
7 | #ifndef __BS_ERROR_H_
8 | #define __BS_ERROR_H_
9 |
10 | #define BS_SUCCESS 0
11 | #define BS_INVALID -1
12 | // 没有达到所需结果,但无需处理,不是错误
13 | #define BS_NOMATTER -2
14 | // 等待结果中,尚未出错
15 | #define BS_WAITING -3
16 |
17 | // 文件相关
18 | #define BS_NOTFOUND -10
19 | #define BS_HASEXIST -11
20 | #define BS_CREATERR -12
21 |
22 | // 内存相关
23 | #define BS_NOMEM -22
24 | #define BS_NOBUFFER -23
25 |
26 | // 参数相关
27 | #define BS_PARAERR -31
28 | #define BS_PARANULL -32
29 | #define BS_JSONPARSE -33
30 |
31 | // 通信相关
32 | #define BS_HOSTERR -41
33 | #define BS_SOCKERR -42
34 | #define BS_STREAMERR -43
35 | #define BS_EPOLLERR -44
36 | #define BS_TIMEOUT -45
37 | #define BS_CONNERR -46
38 | #define BS_SENDERR -47
39 | #define BS_RECVERR -48
40 |
41 | // 进程相关
42 | #define BS_PROCERR -51
43 | #define BS_PROCSHUT -52
44 |
45 | // 权限相关
46 | #define BS_AUTHORITY -61
47 |
48 | // 数据库相关
49 | #define BS_DBERR -71
50 |
51 | // 容量相关
52 | #define BS_FULL -81
53 | #define BS_EMPTY -82
54 | #define BS_CROSSBORDER -83
55 |
56 | // 环境相关
57 | #define BS_ENVIERR -91
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/src/output/include/bs_file.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_file.h
3 | * author : Rex
4 | * create : 2018-11-04 13:20
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __BS_FILE_H_
10 | #define __BS_FILE_H_
11 |
12 | #include
13 | #include "bs_type.h"
14 | #include "bs_object.h"
15 |
16 | #ifdef __cplusplus
17 | extern "C"{
18 | #endif
19 |
20 | typedef struct {
21 | object_t base;
22 | char folder[1024];
23 | char file[1024];
24 | char* buffer;
25 | uint32_t size;
26 | }folder_t;
27 |
28 | void* folder_init(void* p);
29 | void folder_destroy(void* p);
30 |
31 | status_t folder_open(folder_t* f, const char* folder);
32 | const char* folder_type(folder_t* f, const char* type);
33 | const char* folder_read(folder_t* f, const char* file);
34 | const char* folder_read_file(folder_t* f, const char* file);
35 |
36 | #ifdef __cplusplus
37 | }
38 | #endif
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/output/include/bs_lock.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_lock.h
3 | * author : bushaofeng
4 | * create : 2013-11-19 23:00
5 | * func :
6 | */
7 |
8 | #ifndef __BS_LOCK_H_
9 | #define __BS_LOCK_H_
10 |
11 | #include "bs_type.h"
12 | #include "bs_error.h"
13 |
14 | #ifdef __cplusplus
15 | extern "C"{
16 | #endif
17 |
18 | typedef int bs_lock_t;
19 |
20 | #define SPINLOCK_INIT(lock) ((lock)=0)
21 | #define SPINLOCK_LOCK(lock) while(++lock>1){ \
22 | --lock; \
23 | }
24 | #define SPINLOCK_TRYLOCK(lock) (++lock==1 ? BS_SUCCESS:(--lock))
25 | #define SPINLOCK_UNLOCK(lock) (--lock)
26 |
27 | void bs_lock_init(bs_lock_t* lock);
28 | void bs_rdlock(bs_lock_t* lock);
29 | state_t bs_rdlock_try(bs_lock_t* lock);
30 | state_t bs_rdlock_unlock(bs_lock_t* lock);
31 |
32 | void bs_wrlock(bs_lock_t* lock);
33 | state_t bs_wrlock_try(bs_lock_t* lock);
34 | void bs_wrlock_unlock(bs_lock_t* lock);
35 |
36 |
37 | #ifdef __cplusplus
38 | }
39 | #endif
40 | #endif
41 |
--------------------------------------------------------------------------------
/src/output/include/bs_mmap.h:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofeng. 2011.8.17
3 | * bs_mmap.c
4 | * history:
5 | */
6 |
7 | #ifndef BS_MMAP_H_
8 | #define BS_MMAP_H_
9 |
10 | #include "bs_type.h"
11 | #include "bs_error.h"
12 | #include "bs_def.h"
13 |
14 | #ifdef __cplusplus
15 | extern "C"{
16 | #endif
17 |
18 | void* bs_mmap_create(int size);
19 | void* bs_mmap_file(char* file, size_t size);
20 |
21 | #ifdef __cplusplus
22 | }
23 | #endif
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/src/output/include/bs_object.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_object.h
3 | * author : bushaofeng
4 | * create : 2016-08-25 13:22
5 | * func : c语言实现面向对象
6 | * history:
7 | */
8 |
9 | #ifndef __BS_OBJECT_H_
10 | #define __BS_OBJECT_H_
11 |
12 | #include "bs_type.h"
13 | #include "bs_error.h"
14 | #ifdef __cplusplus
15 | extern "C"{
16 | #endif
17 |
18 | #define OBJECT_NAME_SIZE 64
19 |
20 | typedef struct object_t{
21 | bool_t dynamic:1; // 是否动态申请,在各个子类的init函数需要将object base设置为0
22 | uint32_t size:31;
23 | char name[OBJECT_NAME_SIZE];
24 | // 构造函数
25 | void* (*constructor)(void*);
26 | // 析构函数
27 | void (*destructor)(void*);
28 | }object_t;
29 |
30 | /// 创建一个对象
31 | void* new_object(const char* name, uint32_t esize, void* (*constructor)(void*), void (*destructor)(void*));
32 |
33 | /// 创建一个对象
34 | #define bs_new(type) ((type##_t*)new_object(#type, sizeof(type##_t), type##_init, type##_destroy))
35 |
36 | #define bs_init(obj, type) do{ \
37 | memset(obj, 0, sizeof(type##_t)); \
38 | type##_init(obj); \
39 | }while(0)
40 |
41 | /// 销毁对象
42 | #define bs_delete(o) do{ \
43 | ((object_t*)(o))->destructor(o); \
44 | if(((object_t*)(o))->dynamic) free(o); \
45 | }while(0)
46 |
47 | /// 对象类型名
48 | #define typename(o) ((object_t*)(o))->name
49 |
50 | #ifdef __cplusplus
51 | }
52 | #endif
53 | #endif
54 |
--------------------------------------------------------------------------------
/src/output/include/bs_sign.h:
--------------------------------------------------------------------------------
1 | /**
2 | * bushaofeng. 2012.3.17
3 | */
4 |
5 | #ifndef __BS_SIGN_H_
6 | #define __BS_SIGN_H_
7 |
8 | #include "bs_type.h"
9 | #include "bs_error.h"
10 |
11 | #ifdef __cplusplus
12 | extern "C"{
13 | #endif
14 |
15 | #define BS_MD5_STRLEN 32
16 |
17 | /*
18 | typedef struct{
19 | uint16_t sign1;
20 | unsigned char sign2[BS_MD5_STRLEN-sizeof(uint16_t)];
21 | }bs_sign_t;
22 | */
23 | typedef char bs_sign_t[BS_MD5_STRLEN+1];
24 |
25 | uint32_t bs_crc32(uint32_t crc, void* buf, uint32_t size);
26 | int bs_sign(char* buf, bs_sign_t sign);
27 | uint64_t bs_usign(char* buf);
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/output/include/bs_string.h:
--------------------------------------------------------------------------------
1 | /**
2 | * file : bs_string.h
3 | * author : bushaofeng
4 | * create : 2016-08-25 01:03
5 | * func :
6 | * history:
7 | */
8 |
9 | #ifndef __BS_STRING_H_
10 | #define __BS_STRING_H_
11 |
12 | #include "bs_type.h"
13 | #include "bs_error.h"
14 | #include "bs_object.h"
15 |
16 | #ifdef __cplusplus
17 | extern "C"{
18 | #endif
19 |
20 | #define STRING_DEF_SIZE 64
21 |
22 | typedef struct string_t{
23 | object_t base;
24 | uint32_t size;
25 | uint32_t len;
26 | char* mem;
27 | status_t (*set)(struct string_t* str, const char* s);
28 | status_t (*append)(struct string_t* str, const char* s);
29 | }string_t;
30 |
31 | void* string_init(void* p);
32 | void string_destroy(void* p);
33 | status_t string_set(struct string_t* str, const char* s);
34 | status_t string_append(string_t* str, const char* s);
35 |
36 | #define string_memory(s) ((s)->mem)
37 | // 内容长度,data的长度用size,string的长度用length
38 | #define string_size(s) ((s)->len)
39 |
40 | #define string_char(s) ((s)->mem)
41 | #define string_len(s) ((s)->len)
42 | #define string_substr(s, i) ((s)->mem+i)
43 |
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 | #endif
48 |
--------------------------------------------------------------------------------