Commit 5e2de0cb authored by Sebastian Ramacher's avatar Sebastian Ramacher

New upstream version 1.7.2

parent 72f35cdc
libva NEWS -- summary of user visible changes. 2016-06-21
libva NEWS -- summary of user visible changes. 2016-09-05
Copyright (C) 2009-2016 Intel Corporation
Version 1.7.2 - 05.Sep.2016
* Bump VA API version to 0.39.3
* API: add support for ROI
* Add support for VP9 encoder in VA tracer
* Refine test cases
* Fix the issue of not properly terminating the parsed environment values with '\0'
https://bugs.freedesktop.org/show_bug.cgi?id=96677
Version 1.7.1 - 21.Jun.2016
* Bump VA API version to 0.39.2
* API: add support for VP9 8bit encode
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libva 1.7.1.
# Generated by GNU Autoconf 2.69 for libva 1.7.2.
#
# Report bugs to <waldo.bastian@intel.com>.
#
......@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libva'
PACKAGE_TARNAME='libva'
PACKAGE_VERSION='1.7.1'
PACKAGE_STRING='libva 1.7.1'
PACKAGE_VERSION='1.7.2'
PACKAGE_STRING='libva 1.7.2'
PACKAGE_BUGREPORT='waldo.bastian@intel.com'
PACKAGE_URL=''
......@@ -1395,7 +1395,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libva 1.7.1 to adapt to many kinds of systems.
\`configure' configures libva 1.7.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1465,7 +1465,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libva 1.7.1:";;
short | recursive ) echo "Configuration of libva 1.7.2:";;
esac
cat <<\_ACEOF
......@@ -1605,7 +1605,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libva configure 1.7.1
libva configure 1.7.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -2095,7 +2095,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libva $as_me 1.7.1, which was
It was created by libva $as_me 1.7.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -2960,7 +2960,7 @@ fi
# Define the identity of the package.
PACKAGE='libva'
VERSION='1.7.1'
VERSION='1.7.2'
cat >>confdefs.h <<_ACEOF
......@@ -3100,8 +3100,8 @@ TODAY="`LC_ALL=C date +'%a, %d %b %Y %X %z'`"
VA_API_MAJOR_VERSION=0
VA_API_MINOR_VERSION=39
VA_API_MICRO_VERSION=2
VA_API_VERSION=0.39.2
VA_API_MICRO_VERSION=3
VA_API_VERSION=0.39.3
......@@ -3109,16 +3109,16 @@ VA_API_VERSION=0.39.2
LIBVA_MAJOR_VERSION=1
LIBVA_MINOR_VERSION=7
LIBVA_MICRO_VERSION=1
LIBVA_VERSION=1.7.1
LIBVA_MICRO_VERSION=2
LIBVA_VERSION=1.7.2
LIBVA_LT_CURRENT=3903
LIBVA_LT_CURRENT=3904
LIBVA_LT_REV=0
LIBVA_LT_AGE=3902
LIBVA_LT_AGE=3903
LIBVA_LT_VERSION="$LIBVA_LT_CURRENT:$LIBVA_LT_REV:$LIBVA_LT_AGE"
LIBVA_LT_LDFLAGS="-version-info $LIBVA_LT_VERSION"
......@@ -18083,7 +18083,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libva $as_me 1.7.1, which was
This file was extended by libva $as_me 1.7.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -18149,7 +18149,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libva config.status 1.7.1
libva config.status 1.7.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -28,7 +28,7 @@
# - reset minor version to zero when major version is incremented
m4_define([va_api_major_version], [0])
m4_define([va_api_minor_version], [39])
m4_define([va_api_micro_version], [2])
m4_define([va_api_micro_version], [3])
m4_define([va_api_version],
[va_api_major_version.va_api_minor_version.va_api_micro_version])
......@@ -42,7 +42,7 @@ m4_define([va_api_version],
# - reset micro version to zero when VA-API major or minor version is changed
m4_define([libva_major_version], [m4_eval(va_api_major_version + 1)])
m4_define([libva_minor_version], [m4_eval(va_api_minor_version - 32)])
m4_define([libva_micro_version], [1])
m4_define([libva_micro_version], [2])
m4_define([libva_pre_version], [0])
m4_define([libva_version],
......
......@@ -317,9 +317,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign debian.upstream/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu debian.upstream/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign debian.upstream/Makefile
$(AUTOMAKE) --gnu debian.upstream/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
......
libva (1.7.1-1) unstable; urgency=low
libva (1.7.2-1) unstable; urgency=low
* Autogenerated package, see NEWS file for ChangeLog.
-- Gwenole Beauchesne <gwenole.beauchesne@intel.com> Tue, 21 Jun 2016 09:33:05 +0800
-- Gwenole Beauchesne <gwenole.beauchesne@intel.com> Mon, 05 Sep 2016 10:30:33 +0800
......@@ -314,9 +314,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign doc/Makefile
$(AUTOMAKE) --gnu doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
......
......@@ -396,9 +396,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign dummy_drv_video/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dummy_drv_video/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign dummy_drv_video/Makefile
$(AUTOMAKE) --gnu dummy_drv_video/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
......
......@@ -349,9 +349,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign pkgconfig/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pkgconfig/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign pkgconfig/Makefile
$(AUTOMAKE) --gnu pkgconfig/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
......
......@@ -361,9 +361,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign test/Makefile
$(AUTOMAKE) --gnu test/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
......
......@@ -427,9 +427,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/basic/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/basic/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign test/basic/Makefile
$(AUTOMAKE) --gnu test/basic/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
......
......@@ -36,7 +36,7 @@ void test()
{
int max_entrypoints;
int num_entrypoints;
int i, j, k;
int i, j;
int config_count = 0;
max_entrypoints = vaMaxNumEntrypoints(va_dpy);
ASSERT(max_entrypoints > 0);
......@@ -44,6 +44,7 @@ void test()
ASSERT(entrypoints);
VAConfigID *configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID));
ASSERT(configs);
for(i = 0; i < num_profiles; i++)
{
......
......@@ -36,7 +36,7 @@ int config_count = 0;
void pre()
{
int i, j, k;
int i, j;
test_init();
test_profiles();
......@@ -74,6 +74,7 @@ void test()
ASSERT(max_attribs > 0);
VAConfigAttrib *attrib_list = malloc(max_attribs * sizeof(VAConfigAttrib));
ASSERT(attrib_list);
config_count = 0;
for(i = 0; i < num_profiles; i++)
......
......@@ -84,7 +84,7 @@ void test()
test_unique_surfaces(surfaces_4, 4, surfaces_16, 4);
test_unique_surfaces(surfaces_4, 4, surfaces_16, 16);
test_unique_surfaces(surfaces_4, 1, surfaces_16, 16);
test_unique_surfaces(surfaces_1, 16, surfaces_16, 16);
test_unique_surfaces(surfaces_1, 1, surfaces_16, 16);
status("vaDestroySurface 4 surfaces\n");
va_status = vaDestroySurfaces(va_dpy, surfaces_4, 4);
......@@ -98,7 +98,7 @@ void test()
test_unique_surfaces(surfaces_1, 1, surfaces_6, 6);
test_unique_surfaces(surfaces_6, 6, surfaces_16, 16);
test_unique_surfaces(surfaces_1, 6, surfaces_16, 6);
test_unique_surfaces(surfaces_1, 1, surfaces_16, 6);
status("vaDestroySurface 16 surfaces\n");
va_status = vaDestroySurfaces(va_dpy, surfaces_16, 16);
......
......@@ -36,7 +36,7 @@ void test()
{
int max_entrypoints;
int num_entrypoints;
int i, j, k;
int i, j;
int config_count = 0;
max_entrypoints = vaMaxNumEntrypoints(va_dpy);
ASSERT(max_entrypoints > 0);
......@@ -44,7 +44,9 @@ void test()
ASSERT(entrypoints);
VAConfigID *configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID));
ASSERT(configs);
VAContextID *contexts = malloc(max_entrypoints * num_profiles * sizeof(VAContextID));
ASSERT(contexts);
for(i = 0; i < num_profiles; i++)
{
......@@ -67,6 +69,7 @@ void test()
int total_surfaces = config_count * surface_count;
VASurfaceID *surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
ASSERT(surfaces);
// TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed for each config
va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
......
......@@ -45,6 +45,7 @@ void pre()
total_surfaces = surface_count;
surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
assert(surfaces);
// TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed for each config
va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
......
......@@ -45,6 +45,7 @@ void pre()
total_surfaces = surface_count;
surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
assert(surfaces);
// TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed for each config
va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
......
......@@ -109,6 +109,12 @@ const char *profile2string(VAProfile profile)
PROFILE(VC1Advanced)
PROFILE(JPEGBaseline)
PROFILE(VP8Version0_3)
PROFILE(HEVCMain)
PROFILE(HEVCMain10)
PROFILE(VP9Profile0)
PROFILE(VP9Profile1)
PROFILE(VP9Profile2)
PROFILE(VP9Profile3)
}
ASSERT(0);
return "Unknown";
......@@ -127,6 +133,7 @@ const char *entrypoint2string(VAEntrypoint entrypoint)
ENTRYPOINT(Deblocking)
ENTRYPOINT(EncSlice)
ENTRYPOINT(EncPicture)
ENTRYPOINT(EncSliceLP)
ENTRYPOINT(VideoProc)
}
ASSERT(0);
......
......@@ -398,9 +398,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/common/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/common/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign test/common/Makefile
$(AUTOMAKE) --gnu test/common/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
......
......@@ -393,9 +393,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/decode/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/decode/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign test/decode/Makefile
$(AUTOMAKE) --gnu test/decode/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
......
......@@ -154,19 +154,23 @@ static VAHuffmanTableBufferJPEGBaseline default_huffman_table_param={
static int build_default_huffman_tables(struct jdec_private *priv)
{
int i = 0;
if (priv->default_huffman_table_initialized)
return 0;
if (priv->default_huffman_table_initialized)
return 0;
for (i = 0; i < 4; i++) {
priv->HTDC_valid[i] = 1;
memcpy(priv->HTDC[i].bits, default_huffman_table_param.huffman_table[i].num_dc_codes, 16);
memcpy(priv->HTDC[i].values, default_huffman_table_param.huffman_table[i].dc_values, 16);
memcpy(priv->HTDC[i].bits, default_huffman_table_param.huffman_table[i%2].num_dc_codes,
sizeof(default_huffman_table_param.huffman_table[i%2].num_dc_codes));
memcpy(priv->HTDC[i].values, default_huffman_table_param.huffman_table[i%2].dc_values,
sizeof(default_huffman_table_param.huffman_table[i%2].dc_values));
priv->HTAC_valid[i] = 1;
memcpy(priv->HTAC[i].bits, default_huffman_table_param.huffman_table[i].num_ac_codes, 16);
memcpy(priv->HTAC[i].values, default_huffman_table_param.huffman_table[i].ac_values, 256);
memcpy(priv->HTAC[i].bits, default_huffman_table_param.huffman_table[i%2].num_ac_codes,
sizeof(default_huffman_table_param.huffman_table[i%2].num_ac_codes));
memcpy(priv->HTAC[i].values, default_huffman_table_param.huffman_table[i%2].ac_values,
sizeof(default_huffman_table_param.huffman_table[i%2].ac_values));
}
priv->default_huffman_table_initialized = 1;
return 0;
priv->default_huffman_table_initialized = 1;
return 0;
}
......
......@@ -417,9 +417,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/encode/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/encode/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign test/encode/Makefile
$(AUTOMAKE) --gnu test/encode/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
......
......@@ -91,6 +91,7 @@ static int intra_period = 30;
static int frame_bit_rate = -1;
static int frame_rate = 30;
static int ip_period = 1;
static int roi_test_enable = 0;
static VAEntrypoint select_entrypoint = VAEntrypointEncSlice;
......@@ -106,6 +107,7 @@ static const struct option longopts[] = {
{"fb", required_argument, 0, 2},
{"mode", required_argument, 0, 3},
{"low-power", no_argument, 0, 4},
{"roi-test", no_argument, 0, 5},
{ NULL, 0, NULL, 0}
};
......@@ -154,6 +156,7 @@ static struct {
VABufferID packed_sei_header_param_buf_id; /* the SEI buffer */
VABufferID packed_sei_buf_id;
VABufferID misc_parameter_hrd_buf_id;
VABufferID misc_parameter_roi_buf_id;
int num_slices;
int codedbuf_i_size;
......@@ -185,7 +188,7 @@ static void create_encode_pipe()
{
VAEntrypoint entrypoints[5];
int num_entrypoints,slice_entrypoint;
VAConfigAttrib attrib[2];
VAConfigAttrib attrib[3];
int major_ver, minor_ver;
VAStatus va_status;
......@@ -209,8 +212,11 @@ static void create_encode_pipe()
/* find out the format for the render target, and rate control mode */
attrib[0].type = VAConfigAttribRTFormat;
attrib[1].type = VAConfigAttribRateControl;
/* This is to query whether the ROI is supported */
attrib[2].type = VAConfigAttribEncROI;
vaGetConfigAttributes(va_dpy, avcenc_context.profile, select_entrypoint,
&attrib[0], 2);
&attrib[0], 3);
if ((attrib[0].value & VA_RT_FORMAT_YUV420) == 0) {
/* not find desired YUV420 RT format */
......@@ -223,11 +229,30 @@ static void create_encode_pipe()
assert(0);
}
if (roi_test_enable){
if (attrib[2].value != VA_ATTRIB_NOT_SUPPORTED) {
VAConfigAttribValEncROI *roi_config = (VAConfigAttribValEncROI *)&(attrib[2].value);
if(roi_config->bits.num_roi_regions == 0 ||
roi_config->bits.roi_rc_qp_delat_support == 0) {
roi_test_enable = 0;
printf("WARNING: do not support ROI or ROI delta QP ! \n");
}
} else {
roi_test_enable = 0;
printf("WARNING: do not support VAConfigAttribValEncROI! \n");
}
}
attrib[0].value = VA_RT_FORMAT_YUV420; /* set to desired RT format */
attrib[1].value = avcenc_context.rate_control_method; /* set to desired RC mode */
va_status = vaCreateConfig(va_dpy, avcenc_context.profile, select_entrypoint,
&attrib[0], 2,&avcenc_context.config_id);
if (roi_test_enable){
va_status = vaCreateConfig(va_dpy, avcenc_context.profile, select_entrypoint,
&attrib[0], 3,&avcenc_context.config_id);
}else {
va_status = vaCreateConfig(va_dpy, avcenc_context.profile, select_entrypoint,
&attrib[0], 2,&avcenc_context.config_id);
}
CHECK_VASTATUS(va_status, "vaCreateConfig");
/* Create a context for this decode pipe */
......@@ -814,13 +839,65 @@ static int begin_picture(FILE *yuv_fp, int frame_num, int display_num, int slice
vaUnmapBuffer(va_dpy, avcenc_context.misc_parameter_hrd_buf_id);
/* ROI parameter: hard code for test on only one region (0,0,120,120) with qp_delta=4 */
if(roi_test_enable)
{
VAEncMiscParameterBufferROI *misc_roi_param;
int roi_num = 1;
vaCreateBuffer(va_dpy,
avcenc_context.context_id,
VAEncMiscParameterBufferType,
sizeof(VAEncMiscParameterBuffer) + sizeof(VAEncMiscParameterBufferROI) + roi_num * sizeof(VAEncROI),
1,
NULL,
&avcenc_context.misc_parameter_roi_buf_id);
vaMapBuffer(va_dpy,
avcenc_context.misc_parameter_roi_buf_id,
(void **)&misc_param);
misc_param->type = VAEncMiscParameterTypeROI;
misc_roi_param = (VAEncMiscParameterBufferROI *)misc_param->data;
{
misc_roi_param->roi_flags.bits.roi_value_is_qp_delta = 1;
/*
* Max/Min delta_qp is only used in CBR mode. It is ingored under CQP mode.
* max_delta_qp means the allowed upper bound of qp delta. (qp + X)
* min_delta_qp means the allowed lower bound of qp delta. (qp -X)
* So it will be better that it is positive. Otherwise the driver will
* use the default bound setting.
*/
misc_roi_param->max_delta_qp = 3;
misc_roi_param->min_delta_qp = 3;
/* one example of ROI region conf.
* please change it on the fly.
*/
VAEncROI *region_roi =(VAEncROI *)((char *)misc_param + sizeof(VAEncMiscParameterBuffer) +
sizeof(VAEncMiscParameterBufferROI));
/*
* Under CQP mode roi_value specifies the qp_delta that is added to frame qp
* Under CBR mode roi_value specifies the important level (positive means that
* it is important. negative means that it is less important).
*/
region_roi->roi_value = 4;
region_roi->roi_rectangle.x = 0;
region_roi->roi_rectangle.y = 0;
region_roi->roi_rectangle.width = (120 < picture_width/4)? 120:picture_width/4;
region_roi->roi_rectangle.height = (120 < picture_height/4)? 120:picture_height/4;
misc_roi_param->roi = region_roi;
misc_roi_param->num_roi = 1;
}
vaUnmapBuffer(va_dpy, avcenc_context.misc_parameter_roi_buf_id);
}
return 0;
}
int avcenc_render_picture()
{
VAStatus va_status;
VABufferID va_buffers[10];
VABufferID va_buffers[20];
unsigned int num_va_buffers = 0;
int i;
......@@ -848,6 +925,9 @@ int avcenc_render_picture()
if (avcenc_context.misc_parameter_hrd_buf_id != VA_INVALID_ID)
va_buffers[num_va_buffers++] = avcenc_context.misc_parameter_hrd_buf_id;
if (avcenc_context.misc_parameter_roi_buf_id != VA_INVALID_ID)
va_buffers[num_va_buffers++] = avcenc_context.misc_parameter_roi_buf_id;
va_status = vaBeginPicture(va_dpy,
avcenc_context.context_id,
surface_ids[avcenc_context.current_input_surface]);
......@@ -904,6 +984,7 @@ static void end_picture()
avcenc_destroy_buffers(&avcenc_context.slice_param_buf_id[0], avcenc_context.num_slices);
avcenc_destroy_buffers(&avcenc_context.codedbuf_buf_id, 1);
avcenc_destroy_buffers(&avcenc_context.misc_parameter_hrd_buf_id, 1);
avcenc_destroy_buffers(&avcenc_context.misc_parameter_roi_buf_id, 1);
memset(avcenc_context.slice_param, 0, sizeof(avcenc_context.slice_param));
avcenc_context.num_slices = 0;
......@@ -953,6 +1034,7 @@ bitstream_start(bitstream *bs)
{
bs->max_size_in_dword = BITSTREAM_ALLOCATE_STEPPING;
bs->buffer = calloc(bs->max_size_in_dword * sizeof(int), 1);
assert(bs->buffer);
bs->bit_offset = 0;
}
......@@ -990,6 +1072,7 @@ bitstream_put_ui(bitstream *bs, unsigned int val, int size_in_bits)
if (pos + 1 == bs->max_size_in_dword) {
bs->max_size_in_dword += BITSTREAM_ALLOCATE_STEPPING;
bs->buffer = realloc(bs->buffer, bs->max_size_in_dword * sizeof(unsigned int));
assert(bs->buffer);
}
bs->buffer[pos + 1] = val;
......@@ -1691,7 +1774,7 @@ encode_picture(FILE *yuv_fp, FILE *avc_fp,
static void show_help()
{
printf("Usage: avnenc <width> <height> <input_yuvfile> <output_avcfile> [--qp=qpvalue|--fb=framebitrate] [--mode=0(I frames only)/1(I and P frames)/2(I, P and B frames)] [--low-power]\n");
printf("Usage: avnenc <width> <height> <input_yuvfile> <output_avcfile> [--qp=qpvalue|--fb=framebitrate] [--mode=0(I frames only)/1(I and P frames)/2(I, P and B frames)] [--low-power] [--roi-test]\n");
}
static void avcenc_context_seq_param_init(VAEncSequenceParameterBufferH264 *seq_param,
......@@ -1831,6 +1914,7 @@ static void avcenc_context_init(int width, int height)
avcenc_context.upload_thread_value = -1;
avcenc_context.packed_sei_header_param_buf_id = VA_INVALID_ID;
avcenc_context.packed_sei_buf_id = VA_INVALID_ID;
avcenc_context.misc_parameter_roi_buf_id = VA_INVALID_ID;
if (qp_value == -1)
avcenc_context.rate_control_method = VA_RC_CBR;
......@@ -1874,7 +1958,7 @@ int main(int argc, char *argv[])
picture_height_in_mbs = (picture_height + 15) / 16;
if (argc > 5) {
char o;
int o;
optind = 5;
......@@ -1926,6 +2010,10 @@ int main(int argc, char *argv[])
select_entrypoint = VAEntrypointEncSliceLP;
break;
case 5: // roi-test enable/disable
roi_test_enable = 1;
break;
default:
show_help();
return -1;
......
......@@ -197,6 +197,7 @@ bitstream_start(bitstream *bs)
{
bs->max_size_in_dword = BITSTREAM_ALLOCATE_STEPPING;
bs->buffer = calloc(bs->max_size_in_dword * sizeof(int), 1);
assert(bs->buffer);
bs->bit_offset = 0;
}
......@@ -234,6 +235,7 @@ bitstream_put_ui(bitstream *bs, unsigned int val, int size_in_bits)
if (pos + 1 == bs->max_size_in_dword) {
bs->max_size_in_dword += BITSTREAM_ALLOCATE_STEPPING;
bs->buffer = realloc(bs->buffer, bs->max_size_in_dword * sizeof(unsigned int));
assert(bs->buffer);
}
bs->buffer[pos + 1] = val;
......@@ -858,7 +860,7 @@ static int print_help(void)
static int process_cmdline(int argc, char *argv[])
{
char c;
int c;
const struct option long_opts[] = {
{"help", no_argument, NULL, 0 },
{"bitrate", required_argument, NULL, 1 },
......@@ -1940,13 +1942,47 @@ static int save_recyuv(VASurfaceID surface_id,
if (srcyuv_fourcc == VA_FOURCC_NV12) {
int uv_size = 2 * (frame_width/2) * (frame_height/2);
dst_Y = malloc(2*uv_size);
if(dst_Y == NULL) {
printf("Failed to allocate memory for dst_Y\n");
exit(1);
}
dst_U = malloc(uv_size);
if(dst_U == NULL) {
printf("Failed to allocate memory for dst_U\n");
free(dst_Y);
exit(1);
}
memset(dst_Y, 0, 2*uv_size);
memset(dst_U, 0, uv_size);
} else if (srcyuv_fourcc == VA_FOURCC_IYUV ||
srcyuv_fourcc == VA_FOURCC_YV12) {
int uv_size = (frame_width/2) * (frame_height/2);
dst_Y = malloc(4*uv_size);
if(dst_Y == NULL) {
printf("Failed to allocate memory for dst_Y\n");
exit(1);
}
dst_U = malloc(uv_size);
if(dst_U == NULL) {
printf("Failed to allocate memory for dst_U\n");
free(dst_Y);
exit(1);
}
dst_V = malloc(uv_size);
if(dst_V == NULL) {
printf("Failed to allocate memory for dst_V\n");
free(dst_Y);
free(dst_U);
exit(1);
}
memset(dst_Y, 0, 4*uv_size);
memset(dst_U, 0, uv_size);
memset(dst_V, 0, uv_size);
} else {
printf("Unsupported source YUV format\n");
exit(1);
......@@ -1973,9 +2009,6 @@ static int save_recyuv(VASurfaceID surface_id,
fwrite(dst_V, uv_size, 1, recyuv_fp);
fwrite(dst_U, uv_size, 1, recyuv_fp);
}
} else {
printf("Unsupported YUV format\n");
exit(1);
}
if (dst_Y)
......
......@@ -65,6 +65,7 @@ bitstream_start(bitstream *bs)
{
bs->max_size_in_dword = BITSTREAM_ALLOCATE_STEPPING;
bs->buffer = calloc(bs->max_size_in_dword * sizeof(int), 1);
assert(bs->buffer);
bs->bit_offset = 0;
}
......@@ -105,6 +106,7 @@ bitstream_put_ui(bitstream *bs, unsigned int val, int size_in_bits)
if (pos + 1 == bs->max_size_in_dword) {
bs->max_size_in_dword += BITSTREAM_ALLOCATE_STEPPING;
bs->buffer = realloc(bs->buffer, bs->max_size_in_dword * sizeof(unsigned int));
assert(bs->buffer);
}
bs->buffer[pos + 1] = val;
......
......@@ -831,6 +831,7 @@ mpeg2enc_alloc_va_resources(struct mpeg2enc_context *ctx)
max_entrypoints = vaMaxNumEntrypoints(ctx->va_dpy);
entrypoint_list = malloc(max_entrypoints * sizeof(VAEntrypoint));
assert(entrypoint_list);
vaQueryConfigEntrypoints(ctx->va_dpy,
ctx->profile,
entrypoint_list,
......