summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Yuan <shengquan.yuan@intel.com>2015-07-08 17:30:41 +0800
committerAustin Yuan <shengquan.yuan@intel.com>2015-07-08 17:30:41 +0800
commit4d24331d9bf4813d64e6aa098ff09b3d6cae9fb2 (patch)
tree9a5e17a87f4403bcbeb69ea6b0c2dacf9bbf6483
parentb856bcfa0a7e6e6ea02d5b3de1ea9da164aac868 (diff)
parent15f2755495831439141738bf7e5e096647d8774b (diff)
Merge branch 'fdo-master' into master-fdo
-rw-r--r--vaenc/Android.mk4
-rw-r--r--vaenc/h264encode.c7
-rw-r--r--vaenc/va_encode.c30
-rw-r--r--vaenc/va_surface.c4
4 files changed, 29 insertions, 16 deletions
diff --git a/vaenc/Android.mk b/vaenc/Android.mk
index d5277d9..65b9f5b 100644
--- a/vaenc/Android.mk
+++ b/vaenc/Android.mk
@@ -14,9 +14,9 @@ LOCAL_SRC_FILES := \
LOCAL_CFLAGS += \
-DANDROID
-ifeq ($(TARGET_ARCH),x86_64)
+#ifeq ($(TARGET_ARCH),x86_64)
LOCAL_CFLAGS += -march=x86-64 -D_LINK_C
-endif
+#endif
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../../va \
diff --git a/vaenc/h264encode.c b/vaenc/h264encode.c
index 3f854c4..d69a2ba 100644
--- a/vaenc/h264encode.c
+++ b/vaenc/h264encode.c
@@ -1216,7 +1216,7 @@ static VAStatus h264_get_config(void)
continue;
vaQueryConfigEntrypoints(va_dpy, tmp, entrypoints, &num_entrypoints);
for (slice_entrypoint = 0; slice_entrypoint < num_entrypoints; slice_entrypoint++) {
- if (entrypoints[slice_entrypoint] == VAEntrypointEncSlice) {
+ if (entrypoints[slice_entrypoint] == va_entrypoint) {
support_encode = 1;
h264_profile = tmp;
break;
@@ -1227,7 +1227,7 @@ static VAStatus h264_get_config(void)
}
if (support_encode == 0) {
- printf("Can't find VAEntrypointEncSlice for H264 profiles\n");
+ printf("Can't find the target entrypoint for H264 profiles\n");
exit(1);
} else {
switch (h264_profile) {
@@ -1264,7 +1264,7 @@ static VAStatus h264_get_config(void)
for (i = 0; i < VAConfigAttribTypeMax; i++)
h264_attrib[i].type = i;
- va_status = vaGetConfigAttributes(va_dpy, h264_profile, VAEntrypointEncSlice,
+ va_status = vaGetConfigAttributes(va_dpy, h264_profile, va_entrypoint,
&h264_attrib[0], VAConfigAttribTypeMax);
CHECK_VASTATUS_NOEXIT(va_status, "vaGetConfigAttributes");
@@ -1392,7 +1392,6 @@ static VAStatus h264_get_config(void)
}
va_profile = h264_profile;
- va_entrypoint = VAEntrypointEncSlice;
/*
* Force to use sync mode in order to guarantee dumping
diff --git a/vaenc/va_encode.c b/vaenc/va_encode.c
index 9ceb595..bb34656 100644
--- a/vaenc/va_encode.c
+++ b/vaenc/va_encode.c
@@ -57,7 +57,7 @@ VADisplay va_dpy;
VAProfile va_profile;
char *va_profile_str = NULL;
char *va_level_str = NULL;
-VAEntrypoint va_entrypoint;
+VAEntrypoint va_entrypoint = VAEntrypointEncSlice;
VAConfigAttrib config_attrib[VAConfigAttribTypeMax];
unsigned int config_attrib_num = 0;
unsigned int surface_num = SURFACE_NUM;
@@ -384,6 +384,7 @@ static int print_help(void)
printf(" -bitrate_layer1 to set bitrate for layer 1, VP8 Encoder setting\n");
printf(" -bitrate_layer2 to set bitrate for layer 2, VP8 Encoder setting\n");
printf(" -surface_num [surface number, 4 - 16], default is 16\n");
+ printf(" -entrypoint <LP> to enable VDENC work, default is VAEntrypointEncSlice");
return 0;
}
@@ -450,6 +451,7 @@ static int process_cmdline(int argc, char *argv[])
{"carc", required_argument, NULL, 56},
{"sum", no_argument, NULL, 57},
{"active_pm", no_argument, NULL, 58},
+ {"entrypoint", required_argument, NULL, 59},
{NULL, no_argument, NULL, 0 }};
int long_index, i, tmp, intra_idr_period_tmp = -1;
@@ -711,6 +713,10 @@ static int process_cmdline(int argc, char *argv[])
pm_active = 1;
break;
//case ':':
+ case 59:
+ if (!strncmp(optarg, "LP", 2))
+ va_entrypoint = VAEntrypointEncSliceLP;
+ break;
case '?':
print_help();
exit(0);
@@ -1264,8 +1270,8 @@ static void storage_task(unsigned int display_order, unsigned int encode_order)
va_status = vaSyncSurface(va_dpy, src_surface[display_order % surface_num]);
CHECK_VASTATUS(va_status,"vaSyncSurface");
SyncPictureTicks += GetTickCount() - tmp;
- tmp = GetTickCount();
+ tmp = GetTickCount();
save_codeddata(display_order, encode_order, &rec_surfaceid);
SavePictureTicks += GetTickCount() - tmp;
@@ -1476,16 +1482,27 @@ static int print_performance(unsigned int PictureCount)
ssim = calc_SSIM(srcyuv_fp, recyuv_fp, frame_width, frame_height,MIN(srcyuv_frames, frame_count),
&ssim);
}
+ float core_time;
+ if (encode_syncmode)
+ core_time = BeginPictureTicks + RenderPictureTicks + EndPictureTicks + SyncPictureTicks;
+ else
+ core_time = BeginPictureTicks + RenderPictureTicks + EndPictureTicks;
printf("\n\n");
printf("PERFORMANCE: Frame Rate : %.2f fps (%d frames, %d ms (%.2f ms per frame))\n",
(double) 1000*PictureCount / TotalTicks, PictureCount,
TotalTicks, ((double) TotalTicks) / (double) PictureCount);
+ printf("PERFORMANCE: Core Encoding FPS : %.2f fps (%d frames, %d ms (%.2f ms per frame))\n",
+ (double) 1000*PictureCount / core_time, PictureCount,
+ (int)core_time, ((double) core_time) / (double) PictureCount);
+ if (encode_syncmode)
+ printf(" (Core Encoding includes vaBegin/vaRender/vaEnd/vaSync)\n");
+ else
+ printf(" (Core Encoding includes vaBegin/vaRender/vaEnd; vaSync in another thread and not counted)\n");
+
printf("PERFORMANCE: Compression ratio : %.2f%% (%.0f vs %.0f)\n", frame_size * 100.0/total_size,
frame_size, total_size);
-
- float core_time = BeginPictureTicks + RenderPictureTicks + EndPictureTicks + SyncPictureTicks;
if (&jpeg_codec == current_codec) {
float tmp = (float)frame_width * frame_height * 1.5 * frame_count/((float)TotalTicks/1000)/1024/1024;
float tmp1 = (float)frame_width * frame_height * 1.5 * frame_count/(core_time/1000)/1024/1024;
@@ -1557,16 +1574,13 @@ static int print_performance(unsigned int PictureCount)
SavePictureTicks/(double) ThreadTicks/0.01);
}
printf("PERFORMANCE: =========================================================\n");
- printf("PERFORMANCE: Core Encoding Time(vaBegin/vaRender/vaEnd/vaSync): %d ms (%.2f, %.2f%%)\n",
- (int)core_time, core_time/PictureCount, core_time/TotalTicks/0.01);
return 0;
}
static void release_resouce()
{
- if (
- coded_fp)
+ if (coded_fp)
fclose(coded_fp);
if (srcyuv_fp)
fclose(srcyuv_fp);
diff --git a/vaenc/va_surface.c b/vaenc/va_surface.c
index 3ad13c3..bbb4d16 100644
--- a/vaenc/va_surface.c
+++ b/vaenc/va_surface.c
@@ -132,8 +132,8 @@ VAStatus create_surfaces_external(struct codec_table_t *current_codec)
} else if (surface_type == SURFACE_TYPE_GRALLOC || surface_type == SURFACE_TYPE_GRALLOC_LINEAR) {
unsigned long buffers[SURFACE_NUM];
- va_status = alloc_gralloc_buffer(surface_num, buffers, frame_width_mbaligned, frame_height_mbaligned,
- (surface_type == SURFACE_TYPE_GRALLOC_LINEAR));
+ //va_status = alloc_gralloc_buffer(surface_num, buffers, frame_width_mbaligned, frame_height_mbaligned,
+ // (surface_type == SURFACE_TYPE_GRALLOC_LINEAR));
/* stride need to follow gralloc allocator */
setup_externalbuf(&external_srcbuf, surface_type, &attrib_list[0]);