-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
68 lines (55 loc) · 2.35 KB
/
README
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
chadversary's android-ndk-rutabagas
===================================
In this demo you will find not gems, but mere rutabagas.
This repo currently contains only one demo, but I have more demos waiting to be
pushed.
This buggy demo decodes a video file with the AMedia APIs; imports the
AHardwareBuffer from the decoded video frame into Vulkan using
VK_ANDROID_external_memory_android_hardware_buffer; creates
a VkSamplerYcbcrConversion to convert the AHardwareBuffer's YCbCr colorspace
into RGB; copies the AHardwareBuffer into the VkSurface with a small shader and
the VkSamplerYcbcrConversion.
Bugs
----
- git grep -E 'FIXME|WORKAROUND|FINISHME'
- The demo attempts to *smoothly* play the video, but instead it presents just
a few choppy frames and then unexpectedly stops. Patches welcome.
Build Dependencies
------------------
The Android NDK, of course.
glslc:
CMake must be able to find the 'glslc' executable. The easiest way to
satisfy CMake is to put 'glslc' in your shell's $PATH.
To build and install glslc:
> git clone -b known-good https://github.com/google/shaderc ~/shaderc
> cd ~/shaderc
> ./update_shaderc_sources.py
> cd src
> cmake -G Ninja
> ninja
> sudo ninja install
How to Build and Install
------------------------
> pkg='com.example.media_to_vk_ahb'
> ./gradlew buildDebug
> adb connect $REMOTE
> ./gradlew installDebug
> adb shell pm grant "$pkg" android.permission.READ_EXTERNAL_STORAGE
How to Run
----------
> adb push /your/favorite/video.ext /sdcard/Download/
> adb logcat -c
> adb shell am start -n "$pkg/android.app.NativeActivity" \
-e mediaSrc /sdcard/Download/video.ext
> adb logcat -v color
If the activity dies early with a log message like
"Vulkan does not have device extension VK_EXT_queue_family_foreign"
then edit the #ifdef found by `git grep 'WORKAROUND: VK_EXT_queue_family_foreign'`.
The activity accepts the following optional key/value pairs:
-e useVkExternalFormat (auto|never|always) # default=auto
Control if the AHardwareBuffer is imported with
VkExternalFormatANDROID. If useVkExternalFormat=never but the
AHardwareBuffer requires an external format, then the activity will
abort with a diagnostic log message.
-e useVkValidation (true|false) # default=true
Enable the Vulkan validation layers.