From deff9753a84a93e0a256135c967f7f7c517c9ec7 Mon Sep 17 00:00:00 2001 From: Hirokazu Honda Date: Fri, 15 Nov 2024 09:17:59 +0900 Subject: [PATCH] Support Android build --- Android.bp | 210 ++++++++++++++++++++++++++++++++++ Android.mk | 4 - common/va_display.c | 7 +- common/va_display_android.cpp | 58 ---------- decode/Android.mk | 46 -------- decode/loadjpeg.c | 4 - decode/mpeg2vldemo.cpp | 72 ++++++------ encode/Android.mk | 133 --------------------- encode/avcenc.c | 11 +- encode/h264encode.c | 2 +- encode/jpegenc.c | 5 +- encode/mpeg2vaenc.c | 11 +- encode/svctenc.c | 6 +- encode/vp8enc.c | 13 ++- encode/vp9enc.c | 11 +- vainfo/Android.mk | 25 ---- vainfo/vainfo.c | 16 ++- videoprocess/Android.mk | 23 ---- 18 files changed, 283 insertions(+), 374 deletions(-) create mode 100644 Android.bp delete mode 100644 Android.mk delete mode 100644 common/va_display_android.cpp delete mode 100644 decode/Android.mk delete mode 100644 encode/Android.mk delete mode 100644 vainfo/Android.mk delete mode 100644 videoprocess/Android.mk diff --git a/Android.bp b/Android.bp new file mode 100644 index 00000000..3534b333 --- /dev/null +++ b/Android.bp @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2024 Intel Corporation. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package { + default_applicable_licenses: ["external_libva-utils_license"], +} + +license { + name: "external_libva-utils_license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-Apache-2.0", + "SPDX-license-identifier-BSD", + "SPDX-license-identifier-ISC", + "SPDX-license-identifier-MIT", + ], + license_text: [ + "LICENSE", + ], +} + +cc_defaults { + name: "libva_utils_defaults", + shared_libs: [ + "libva", + "libdl", + "libcutils", + "libutils", + "libgui", + "libdrm", + ], + + vendor: true, + enabled: false, + arch: { + x86_64: { + enabled: true, + }, + }, +} + +cc_library { + name: "libva_utils_common", + + defaults: ["libva_utils_defaults"], + + srcs: [ + "common/va_display.c", + "common/va_display_drm.c", + ], + + export_include_dirs: ["common/"], + + cflags: ["-DHAVE_VA_DRM"], + + visibility: [":__subpackages__"], +} + +cc_defaults { + name: "libva_utils_bin_defaults", + + defaults: ["libva_utils_defaults"], + + shared_libs: [ + "libva_utils_common", + ], +} + +// decode directory + +cc_binary { + name: "vampeg2vldemo", + + srcs: [ + "decode/mpeg2vldemo.cpp", + ], + + defaults: ["libva_utils_bin_defaults"], +} + +cc_binary { + name: "valoadjpeg", + + srcs: [ + "decode/loadjpeg.c", + "decode/tinyjpeg.c", + ], + + defaults: ["libva_utils_bin_defaults"], +} + +// encode directory + +cc_binary { + name: "vah264encode", + + srcs: [ + "encode/h264encode.c", + ], + + defaults: ["libva_utils_bin_defaults"], +} + +cc_binary { + name: "vaavcenc", + + srcs: [ + "encode/avcenc.c", + ], + + defaults: ["libva_utils_bin_defaults"], +} + +cc_binary { + name: "vavp8enc", + + srcs: [ + "encode/vp8enc.c", + ], + + cflags: [ + "-Wno-gnu-variable-sized-type-not-at-end", + ], + + defaults: ["libva_utils_bin_defaults"], +} + +cc_binary { + name: "vavp9enc", + + srcs: [ + "encode/vp9enc.c", + ], + + defaults: ["libva_utils_bin_defaults"], +} + +cc_binary { + name: "vajpegenc", + + srcs: [ + "encode/jpegenc.c", + ], + + defaults: ["libva_utils_bin_defaults"], +} + +cc_binary { + name: "vampeg2vaenc", + + srcs: [ + "encode/mpeg2vaenc.c", + ], + + defaults: ["libva_utils_bin_defaults"], +} + +cc_binary { + name: "vasvctenc", + + srcs: [ + "encode/svctenc.c", + ], + + defaults: ["libva_utils_bin_defaults"], +} + +// vainfo directory + +cc_binary { + name: "vainfo", + + srcs: [ + "vainfo/vainfo.c", + ], + + defaults: ["libva_utils_bin_defaults"], +} + +// videoprocess directory +cc_binary { + name: "vavpp", + + srcs: [ + "videoprocess/vavpp.cpp", + ], + + defaults: ["libva_utils_bin_defaults"], +} diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 5cbb9d8c..00000000 --- a/Android.mk +++ /dev/null @@ -1,4 +0,0 @@ -# Recursive call sub-folder Android.mk -# - - include $(call all-subdir-makefiles) diff --git a/common/va_display.c b/common/va_display.c index 4eb67d4b..8a1be624 100644 --- a/common/va_display.c +++ b/common/va_display.c @@ -40,9 +40,6 @@ extern const VADisplayHooks va_display_hooks_win32; static const VADisplayHooks *g_display_hooks; static const VADisplayHooks *g_display_hooks_available[] = { -#ifdef ANDROID - &va_display_hooks_android, -#else #ifdef HAVE_VA_WIN32 &va_display_hooks_win32, #endif @@ -55,9 +52,7 @@ static const VADisplayHooks *g_display_hooks_available[] = { #ifdef HAVE_VA_DRM &va_display_hooks_drm, #endif -#endif - NULL -}; + NULL}; static const char *g_display_name; const char *g_device_name; diff --git a/common/va_display_android.cpp b/common/va_display_android.cpp deleted file mode 100644 index 140862be..00000000 --- a/common/va_display_android.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018 Intel Corporation. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#include -#include "va_display.h" - -static unsigned int fake_display = 0xdeada01d; - -static VADisplay -va_open_display_android(void) -{ - return vaGetDisplay(&fake_display); -} - -static void -va_close_display_android(VADisplay va_dpy) -{ -} - -static VAStatus -va_put_surface_android( - VADisplay va_dpy, - VASurfaceID surface, - const VARectangle *src_rect, - const VARectangle *dst_rect -) -{ - return VA_STATUS_ERROR_UNIMPLEMENTED; -} - -extern "C" -const VADisplayHooks va_display_hooks_android = { - "android", - va_open_display_android, - va_close_display_android, - va_put_surface_android -}; diff --git a/decode/Android.mk b/decode/Android.mk deleted file mode 100644 index 27600420..00000000 --- a/decode/Android.mk +++ /dev/null @@ -1,46 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -# mpeg2vldemo -# -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - mpeg2vldemo.cpp \ - ../common/va_display.c \ - ../common/va_display_android.cpp - -LOCAL_CFLAGS += \ - -DANDROID - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../common - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := mpeg2vldemo - -LOCAL_SHARED_LIBRARIES := libva libva-android libdl libcutils libutils libgui - -include $(BUILD_EXECUTABLE) - -# loadjpeg -# -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - loadjpeg.c \ - tinyjpeg.c \ - ../common/va_display.c \ - ../common/va_display_android.cpp - -LOCAL_CFLAGS += \ - -DANDROID - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../common - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := loadjpeg - -LOCAL_SHARED_LIBRARIES := libva libva-android libdl libcutils libutils libgui - -include $(BUILD_EXECUTABLE) diff --git a/decode/loadjpeg.c b/decode/loadjpeg.c index 6eefeb37..d84fcda6 100644 --- a/decode/loadjpeg.c +++ b/decode/loadjpeg.c @@ -138,7 +138,3 @@ int main(int argc, char *argv[]) return 0; } - - - - diff --git a/decode/mpeg2vldemo.cpp b/decode/mpeg2vldemo.cpp index 25fe9725..0dff3b77 100644 --- a/decode/mpeg2vldemo.cpp +++ b/decode/mpeg2vldemo.cpp @@ -73,37 +73,36 @@ static unsigned char mpeg2_clip[] = { * please see picture mpeg2-I.jpg for bitstream details */ static VAPictureParameterBufferMPEG2 pic_param = { - horizontal_size: 16, - vertical_size: 16, - forward_reference_picture: 0xffffffff, - backward_reference_picture: 0xffffffff, - picture_coding_type: 1, - f_code: 0xffff, + .horizontal_size = 16, + .vertical_size = 16, + .forward_reference_picture = 0xffffffff, + .backward_reference_picture = 0xffffffff, + .picture_coding_type = 1, + .f_code = 0xffff, { { - intra_dc_precision: 0, - picture_structure: 3, - top_field_first: 0, - frame_pred_frame_dct: 1, - concealment_motion_vectors: 0, - q_scale_type: 0, - intra_vlc_format: 0, - alternate_scan: 0, - repeat_first_field: 0, - progressive_frame: 1, - is_first_field: 1 + .intra_dc_precision = 0, + .picture_structure = 3, + .top_field_first = 0, + .frame_pred_frame_dct = 1, + .concealment_motion_vectors = 0, + .q_scale_type = 0, + .intra_vlc_format = 0, + .alternate_scan = 0, + .repeat_first_field = 0, + .progressive_frame = 1, + .is_first_field = 1 }, } }; /* see MPEG2 spec65 for the defines of matrix */ static VAIQMatrixBufferMPEG2 iq_matrix = { - load_intra_quantiser_matrix: 1, - load_non_intra_quantiser_matrix: 1, - load_chroma_intra_quantiser_matrix: 0, - load_chroma_non_intra_quantiser_matrix: 0, -intra_quantiser_matrix: - { + .load_intra_quantiser_matrix = 1, + .load_non_intra_quantiser_matrix = 1, + .load_chroma_intra_quantiser_matrix = 0, + .load_chroma_non_intra_quantiser_matrix = 0, + .intra_quantiser_matrix = { 8, 16, 16, 19, 16, 19, 22, 22, 22, 22, 22, 22, 26, 24, 26, 27, 27, 27, 26, 26, 26, 26, 27, 27, @@ -112,25 +111,22 @@ static VAIQMatrixBufferMPEG2 iq_matrix = { 34, 34, 37, 38, 37, 35, 35, 34, 35, 38, 38, 40, 40, 40, 48, 48, 46, 46, 56, 56, 58, 69, 69, 83 - }, -non_intra_quantiser_matrix: - {16}, -chroma_intra_quantiser_matrix: - {0}, -chroma_non_intra_quantiser_matrix: - {0} + }, + .non_intra_quantiser_matrix = {16}, + .chroma_intra_quantiser_matrix = {0}, + .chroma_non_intra_quantiser_matrix ={0} }; #if 1 static VASliceParameterBufferMPEG2 slice_param = { - slice_data_size: 150, - slice_data_offset: 0, - slice_data_flag: 0, - macroblock_offset: 38, /* 4byte + 6bits=38bits */ - slice_horizontal_position: 0, - slice_vertical_position: 0, - quantiser_scale_code: 2, - intra_slice_flag: 0 + .slice_data_size = 150, + .slice_data_offset = 0, + .slice_data_flag = 0, + .macroblock_offset = 38, /* 4byte + 6bits=38bits */ + .slice_horizontal_position = 0, + .slice_vertical_position = 0, + .quantiser_scale_code = 2, + .intra_slice_flag = 0 }; #endif diff --git a/encode/Android.mk b/encode/Android.mk deleted file mode 100644 index dbfd7487..00000000 --- a/encode/Android.mk +++ /dev/null @@ -1,133 +0,0 @@ -# h264encode -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - ../common/va_display.c \ - ../common/va_display_android.cpp \ - h264encode.c - -LOCAL_CFLAGS += \ - -DANDROID - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../common - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := h264encode - -LOCAL_SHARED_LIBRARIES := libva-android libva libdl libcutils libutils libgui libm - -include $(BUILD_EXECUTABLE) - -# avcenc -# -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - ../common/va_display.c \ - ../common/va_display_android.cpp \ - avcenc.c - -LOCAL_CFLAGS += \ - -DANDROID - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../common - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := avcenc - -LOCAL_SHARED_LIBRARIES := libva-android libva libdl libcutils libutils libgui - -include $(BUILD_EXECUTABLE) - -# vp9enc -# -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - ../common/va_display.c \ - ../common/va_display_android.cpp \ - vp9enc.c - -LOCAL_CFLAGS += \ - -DANDROID - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../common - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := vp9enc - -LOCAL_SHARED_LIBRARIES := libva-android libva libdl libcutils libutils libgui - -include $(BUILD_EXECUTABLE) - -# jpegenc -# -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - ../common/va_display.c \ - ../common/va_display_android.cpp \ - jpegenc.c - -LOCAL_CFLAGS += \ - -DANDROID - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../common - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := jpegenc - -LOCAL_SHARED_LIBRARIES := libva-android libva libdl libcutils libutils libgui - -include $(BUILD_EXECUTABLE) - -# mpeg2vaenc -# -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - ../common/va_display.c \ - ../common/va_display_android.cpp \ - mpeg2vaenc.c - -LOCAL_CFLAGS += \ - -DANDROID - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../common - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := mpeg2vaenc - -LOCAL_SHARED_LIBRARIES := libva-android libva libdl libcutils libutils libgui - -include $(BUILD_EXECUTABLE) - -# svctenc -# -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - ../common/va_display.c \ - ../common/va_display_android.cpp \ - svctenc.c - -LOCAL_CFLAGS += \ - -DANDROID - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../common - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := svctenc - -LOCAL_SHARED_LIBRARIES := libva-android libva libdl libcutils libutils libgui - -include $(BUILD_EXECUTABLE) diff --git a/encode/avcenc.c b/encode/avcenc.c index 6ab8a460..086e1315 100644 --- a/encode/avcenc.c +++ b/encode/avcenc.c @@ -592,9 +592,10 @@ static void upload_yuv_to_surface(FILE *yuv_fp, VASurfaceID surface_id) u_src = newImageBuffer + y_size; /* UV offset for NV12 */ v_src = newImageBuffer + y_size + u_size; - y_dst = surface_p + surface_image.offsets[0]; - u_dst = surface_p + surface_image.offsets[1]; /* UV offset for NV12 */ - v_dst = surface_p + surface_image.offsets[2]; + y_dst = (unsigned char *)surface_p + surface_image.offsets[0]; + u_dst = (unsigned char *)surface_p + + surface_image.offsets[1]; /* UV offset for NV12 */ + v_dst = (unsigned char *)surface_p + surface_image.offsets[2]; /* Y plane */ for (row = 0; row < surface_image.height; row++) { @@ -619,8 +620,8 @@ static void upload_yuv_to_surface(FILE *yuv_fp, VASurfaceID surface_id) const int U = surface_image.format.fourcc == VA_FOURCC_I420 ? 1 : 2; const int V = surface_image.format.fourcc == VA_FOURCC_I420 ? 2 : 1; - u_dst = surface_p + surface_image.offsets[U]; - v_dst = surface_p + surface_image.offsets[V]; + u_dst = (unsigned char *)surface_p + surface_image.offsets[U]; + v_dst = (unsigned char *)surface_p + surface_image.offsets[V]; for (row = 0; row < surface_image.height / 2; row++) { memcpy(u_dst, u_src, surface_image.width / 2); diff --git a/encode/h264encode.c b/encode/h264encode.c index 230df2d9..45099559 100644 --- a/encode/h264encode.c +++ b/encode/h264encode.c @@ -1113,7 +1113,7 @@ static int init_va(void) selected_entrypoint = entrypoints[slice_entrypoint]; break; } - } else if ((entrypoints[slice_entrypoint] == requested_entrypoint)) { + } else if (entrypoints[slice_entrypoint] == requested_entrypoint) { //Select the entry point based on what was requested in cmd line option support_encode = 1; selected_entrypoint = entrypoints[slice_entrypoint]; diff --git a/encode/jpegenc.c b/encode/jpegenc.c index e86e8c69..cfcc9978 100644 --- a/encode/jpegenc.c +++ b/encode/jpegenc.c @@ -521,8 +521,8 @@ void upload_yuv_to_surface(VADisplay va_dpy, FILE *yuv_fp, VASurfaceID surface_i u_src = newImageBuffer + y_size; /* UV offset for NV12 */ v_src = newImageBuffer + y_size + u_size; - y_dst = surface_p + surface_image.offsets[0]; - u_dst = surface_p + surface_image.offsets[1]; /* UV offset for NV12 */ + y_dst = (unsigned char *)surface_p + surface_image.offsets[0]; + u_dst = (unsigned char *)surface_p + surface_image.offsets[1]; /* UV offset for NV12 */ if ((yuvComp.fourcc_val == VA_FOURCC_NV12) || (yuvComp.fourcc_val == VA_FOURCC_I420) || (yuvComp.fourcc_val == VA_FOURCC_Y800)) { @@ -1001,4 +1001,3 @@ int main(int argc, char *argv[]) return 0; } - diff --git a/encode/mpeg2vaenc.c b/encode/mpeg2vaenc.c index e44ce904..f14405ff 100644 --- a/encode/mpeg2vaenc.c +++ b/encode/mpeg2vaenc.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -277,9 +278,9 @@ find_frame_rate_code(const VAEncSequenceParameterBufferMPEG2 *seq_param) for (i = 0; i < sizeof(frame_rate_tab) / sizeof(frame_rate_tab[0]); i++) { - if (abs(1000 * frame_rate_tab[i].value - 1000 * frame_rate_value) < delta) { + if (fabsf(1000 * frame_rate_tab[i].value - 1000 * frame_rate_value) < delta) { code = frame_rate_tab[i].code; - delta = abs(1000 * frame_rate_tab[i].value - 1000 * frame_rate_value); + delta = fabsf(1000 * frame_rate_tab[i].value - 1000 * frame_rate_value); } } @@ -466,9 +467,9 @@ upload_yuv_to_surface(void *data) u_src = ctx->frame_data_buffer + y_size; /* UV offset for NV12 */ v_src = ctx->frame_data_buffer + y_size + u_size; - y_dst = surface_p + surface_image.offsets[0]; - u_dst = surface_p + surface_image.offsets[1]; /* UV offset for NV12 */ - v_dst = surface_p + surface_image.offsets[2]; + y_dst = (unsigned char *)surface_p + surface_image.offsets[0]; + u_dst = (unsigned char *)surface_p + surface_image.offsets[1]; /* UV offset for NV12 */ + v_dst = (unsigned char *)surface_p + surface_image.offsets[2]; /* Y plane */ for (row = 0; row < surface_image.height; row++) { diff --git a/encode/svctenc.c b/encode/svctenc.c index 605f3ed3..4fa821e5 100644 --- a/encode/svctenc.c +++ b/encode/svctenc.c @@ -1183,9 +1183,9 @@ upload_task(struct svcenc_context *ctx, unsigned int display_order, int surface) u_src = ctx->frame_data_buffer + y_size; /* UV offset for NV12 */ v_src = ctx->frame_data_buffer + y_size + u_size; - y_dst = surface_p + surface_image.offsets[0]; - u_dst = surface_p + surface_image.offsets[1]; /* UV offset for NV12 */ - v_dst = surface_p + surface_image.offsets[2]; + y_dst = (unsigned char *)surface_p + surface_image.offsets[0]; + u_dst = (unsigned char *)surface_p + surface_image.offsets[1]; /* UV offset for NV12 */ + v_dst = (unsigned char *)surface_p + surface_image.offsets[2]; /* Y plane */ for (row = 0; row < surface_image.height; row++) { diff --git a/encode/vp8enc.c b/encode/vp8enc.c index a87ffc87..279bde04 100644 --- a/encode/vp8enc.c +++ b/encode/vp8enc.c @@ -343,10 +343,10 @@ vp8enc_upload_yuv_to_surface(FILE *yuv_fp, VASurfaceID surface_id, int current_f vaMapBuffer(vaapi_context.display, surface_image.buf, &surface_p); assert(VA_STATUS_SUCCESS == va_status); - - y_dst = surface_p + surface_image.offsets[0]; - u_dst = surface_p + surface_image.offsets[1]; /* UV offset for NV12 */ - v_dst = surface_p + surface_image.offsets[2]; + y_dst = (unsigned char *)surface_p + surface_image.offsets[0]; + u_dst = (unsigned char *)surface_p + + surface_image.offsets[1]; /* UV offset for NV12 */ + v_dst = (unsigned char *)surface_p + surface_image.offsets[2]; /* Y plane */ for (row = 0; row < surface_image.height; row++) { @@ -371,8 +371,8 @@ vp8enc_upload_yuv_to_surface(FILE *yuv_fp, VASurfaceID surface_id, int current_f const int U = surface_image.format.fourcc == VA_FOURCC_I420 ? 1 : 2; const int V = surface_image.format.fourcc == VA_FOURCC_I420 ? 2 : 1; - u_dst = surface_p + surface_image.offsets[U]; - v_dst = surface_p + surface_image.offsets[V]; + u_dst = (unsigned char *)surface_p + surface_image.offsets[U]; + v_dst = (unsigned char *)surface_p + surface_image.offsets[V]; for (row = 0; row < surface_image.height / 2; row++) { memcpy(u_dst, u_src, surface_image.width / 2); @@ -598,6 +598,7 @@ VASurfaceID vp8enc_get_unused_surface() fprintf(stderr, "Error: No unused surface found!\n"); assert(0); + return VA_INVALID_ID; // should never happen } VASurfaceID vp8enc_update_reference(VASurfaceID current_surface, VASurfaceID second_copy_surface, bool refresh_with_recon, int copy_flag) diff --git a/encode/vp9enc.c b/encode/vp9enc.c index 14d4609b..b3be91c8 100644 --- a/encode/vp9enc.c +++ b/encode/vp9enc.c @@ -555,9 +555,10 @@ vp9enc_upload_yuv_to_surface(FILE *yuv_fp, VASurfaceID surface_id) u_src = newImageBuffer + y_size; /* UV offset for NV12 */ v_src = newImageBuffer + y_size + u_size; - y_dst = surface_p + surface_image.offsets[0]; - u_dst = surface_p + surface_image.offsets[1]; /* UV offset for NV12 */ - v_dst = surface_p + surface_image.offsets[2]; + y_dst = (unsigned char *)surface_p + surface_image.offsets[0]; + u_dst = (unsigned char *)surface_p + + surface_image.offsets[1]; /* UV offset for NV12 */ + v_dst = (unsigned char *)surface_p + surface_image.offsets[2]; /* Y plane */ for (row = 0; row < surface_image.height; row++) { @@ -582,8 +583,8 @@ vp9enc_upload_yuv_to_surface(FILE *yuv_fp, VASurfaceID surface_id) const int U = surface_image.format.fourcc == VA_FOURCC_I420 ? 1 : 2; const int V = surface_image.format.fourcc == VA_FOURCC_I420 ? 2 : 1; - u_dst = surface_p + surface_image.offsets[U]; - v_dst = surface_p + surface_image.offsets[V]; + u_dst = (unsigned char *)surface_p + surface_image.offsets[U]; + v_dst = (unsigned char *)surface_p + surface_image.offsets[V]; for (row = 0; row < surface_image.height / 2; row++) { memcpy(u_dst, u_src, surface_image.width / 2); diff --git a/vainfo/Android.mk b/vainfo/Android.mk deleted file mode 100644 index 55040c0e..00000000 --- a/vainfo/Android.mk +++ /dev/null @@ -1,25 +0,0 @@ -# For vainfo -# ===================================================== - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - vainfo.c \ - ../common/va_display.c \ - ../common/va_display_android.cpp - -LOCAL_CFLAGS += \ - -DANDROID - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../common - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := vainfo - -LOCAL_SHARED_LIBRARIES := libva-android libva libdl libcutils libutils libgui - -include $(BUILD_EXECUTABLE) - diff --git a/vainfo/vainfo.c b/vainfo/vainfo.c index 59229b27..75d08394 100644 --- a/vainfo/vainfo.c +++ b/vainfo/vainfo.c @@ -34,13 +34,6 @@ #include "va_display.h" -#ifdef ANDROID - -/* Macros generated from configure */ -#define LIBVA_VERSION_S "2.0.0" - -#endif - #define CHECK_VASTATUS(va_status,func, ret) \ if (va_status != VA_STATUS_SUCCESS) { \ fprintf(stderr,"%s failed with error code %d (%s),exit\n",func, va_status, vaErrorStr(va_status)); \ @@ -532,8 +525,13 @@ int main(int argc, const char* argv[]) va_status = vaInitialize(va_dpy, &major_version, &minor_version); CHECK_VASTATUS(va_status, "vaInitialize", 3); - printf("%s: VA-API version: %d.%d (libva %s)\n", - name, major_version, minor_version, LIBVA_VERSION_S); + printf("%s: VA-API version: %d.%d", + name, major_version, minor_version); +#ifdef ANDROID + printf("\n"); +#else + printf(" (libva %s)\n", LIBVA_VERSION_S); +#endif // ANDROID driver = vaQueryVendorString(va_dpy); printf("%s: Driver version: %s\n", name, driver ? driver : ""); diff --git a/videoprocess/Android.mk b/videoprocess/Android.mk deleted file mode 100644 index c4c2caad..00000000 --- a/videoprocess/Android.mk +++ /dev/null @@ -1,23 +0,0 @@ -# vavpp -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - ../common/va_display.c \ - ../common/va_display_android.cpp \ - vavpp.cpp - -LOCAL_CFLAGS += \ - -DANDROID - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../common - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := vavpp - -LOCAL_SHARED_LIBRARIES := libva-android libva libdl libcutils libutils libgui libm - -include $(BUILD_EXECUTABLE)