Skip to content

Commit

Permalink
Add '-Wall' or '-fstack-protector' compilation flags
Browse files Browse the repository at this point in the history
In addition, this fixes all warnings reported by -Wall

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
  • Loading branch information
xhaihao committed Jun 5, 2018
1 parent 71fc4bb commit 1bea64e
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 64 deletions.
4 changes: 4 additions & 0 deletions common/loadsurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ static int upload_surface(VADisplay va_dpy, VASurfaceID surface_id,
return 0;
}

#ifdef LIBVA_UTILS_UPLOAD_DOWNLOAD_YUV_SURFACE

/*
* Upload YUV data from memory into a surface
* if src_fourcc == NV12, assume the buffer pointed by src_U
Expand Down Expand Up @@ -487,3 +489,5 @@ static int download_surface_yuv(VADisplay va_dpy, VASurfaceID surface_id,

return 0;
}

#endif /* LIBVA_UTILS_UPLOAD_DOWNLOAD_YUV_SURFACE */
2 changes: 2 additions & 0 deletions decode/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
bin_PROGRAMS = mpeg2vldemo loadjpeg

AM_CPPFLAGS = \
-Wall \
-fstack-protector \
$(LIBVA_CFLAGS) \
-I$(top_srcdir)/common \
$(NULL)
Expand Down
22 changes: 2 additions & 20 deletions decode/tinyjpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,21 @@ static int build_default_huffman_tables(struct jdec_private *priv)

static void print_SOF(const unsigned char *stream)
{
int width, height, nr_components, precision;
#if DEBUG
int width, height, nr_components, precision;
const char *nr_components_to_string[] = {
"????",
"Grayscale",
"????",
"YCbCr",
"CYMK"
};
#endif

precision = stream[2];
height = be16_to_cpu(stream+3);
width = be16_to_cpu(stream+5);
nr_components = stream[7];
#endif

trace("> SOF marker\n");
trace("Size:%dx%d nr_components:%d (%s) precision:%d\n",
Expand Down Expand Up @@ -578,8 +578,6 @@ int tinyjpeg_decode(struct jdec_private *priv)
unsigned int i, j;

int surface_type;
char *type;
int ChromaTypeIndex;

VASurfaceAttrib forcc;
forcc.type =VASurfaceAttribPixelFormat;
Expand Down Expand Up @@ -644,62 +642,46 @@ int tinyjpeg_decode(struct jdec_private *priv)
//surface_type = VA_RT_FORMAT_IMC3;
surface_type = VA_RT_FORMAT_YUV420;
forcc.value.value.i = VA_FOURCC_IMC3;
ChromaTypeIndex = 1;
type = "VA_FOURCC_IMC3";
}
else if (h1 == 2 && h2 == 1 && h3 == 1 &&
v1 == 1 && v2 == 1 && v3 == 1) {
//surface_type = VA_RT_FORMAT_YUV422H;
surface_type = VA_RT_FORMAT_YUV422;
forcc.value.value.i = VA_FOURCC_422H;
ChromaTypeIndex = 2;
type = "VA_FOURCC_422H";
}
else if (h1 == 1 && h2 == 1 && h3 == 1 &&
v1 == 1 && v2 == 1 && v3 == 1) {
surface_type = VA_RT_FORMAT_YUV444;
forcc.value.value.i = VA_FOURCC_444P;
//forcc.value.value.i = VA_FOURCC_RGBP;
ChromaTypeIndex = 3;
type = "VA_FOURCC_444P";
}
else if (h1 == 4 && h2 == 1 && h3 == 1 &&
v1 == 1 && v2 == 1 && v3 == 1) {
surface_type = VA_RT_FORMAT_YUV411;
forcc.value.value.i = VA_FOURCC_411P;
ChromaTypeIndex = 4;
type = "VA_FOURCC_411P";
}
else if (h1 == 1 && h2 == 1 && h3 == 1 &&
v1 == 2 && v2 == 1 && v3 == 1) {
//surface_type = VA_RT_FORMAT_YUV422V;
surface_type = VA_RT_FORMAT_YUV422;
forcc.value.value.i = VA_FOURCC_422V;
ChromaTypeIndex = 5;
type = "VA_FOURCC_422V";
}
else if (h1 == 2 && h2 == 1 && h3 == 1 &&
v1 == 2 && v2 == 2 && v3 == 2) {
//surface_type = VA_RT_FORMAT_YUV422H;
surface_type = VA_RT_FORMAT_YUV422;
forcc.value.value.i = VA_FOURCC_422H;
ChromaTypeIndex = 6;
type = "VA_FOURCC_422H";
}
else if (h2 == 2 && h2 == 2 && h3 == 2 &&
v1 == 2 && v2 == 1 && v3 == 1) {
//surface_type = VA_RT_FORMAT_YUV422V;
surface_type = VA_RT_FORMAT_YUV422;
forcc.value.value.i = VA_FOURCC_422V;
ChromaTypeIndex = 7;
type = "VA_FOURCC_422V";
}
else
{
surface_type = VA_RT_FORMAT_YUV400;
forcc.value.value.i = VA_FOURCC('Y','8','0','0');
ChromaTypeIndex = 0;
type = "Format_400P";
}

va_status = vaCreateSurfaces(va_dpy,surface_type,
Expand Down
1 change: 1 addition & 0 deletions encode/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ noinst_PROGRAMS = svctenc

AM_CPPFLAGS = \
-Wall \
-fstack-protector \
$(LIBVA_CFLAGS) \
$(NULL)

Expand Down
11 changes: 10 additions & 1 deletion encode/h264encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define LIBVA_UTILS_UPLOAD_DOWNLOAD_YUV_SURFACE 1

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Expand Down Expand Up @@ -564,6 +566,8 @@ build_packed_seq_buffer(unsigned char **header_buffer)
return bs.bit_offset;
}

#if 0

static int
build_packed_sei_buffer_timing(unsigned int init_cpb_removal_length,
unsigned int init_cpb_removal_delay,
Expand Down Expand Up @@ -630,6 +634,8 @@ build_packed_sei_buffer_timing(unsigned int init_cpb_removal_length,
return nal_bs.bit_offset;
}

#endif

static int build_packed_slice_buffer(unsigned char **header_buffer)
{
bitstream bs;
Expand Down Expand Up @@ -1666,6 +1672,8 @@ static int render_packedpicture(void)
return 0;
}

#if 0

static void render_packedsei(void)
{
VAEncPackedHeaderParameterBuffer packed_header_param_buffer;
Expand Down Expand Up @@ -1728,7 +1736,6 @@ static void render_packedsei(void)
return;
}


static int render_hrd(void)
{
VABufferID misc_parameter_hrd_buf_id;
Expand Down Expand Up @@ -1765,6 +1772,8 @@ static int render_hrd(void)
return 0;
}

#endif

static void render_packedslice()
{
VAEncPackedHeaderParameterBuffer packedheader_param_buffer;
Expand Down
2 changes: 2 additions & 0 deletions putsurface/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ bin_PROGRAMS =
TEST_CFLAGS = \
$(LIBVA_CFLAGS) \
-I$(top_srcdir)/common \
-Wall \
-fstack-protector \
$(NULL)

TEST_LIBS = \
Expand Down
2 changes: 2 additions & 0 deletions vainfo/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ vainfo_cflags = \
-I$(top_srcdir)/common \
$(LIBVA_CFLAGS) \
-DLIBVA_VERSION_S="\"$(LIBVA_VERSION)\"" \
-Wall \
-fstack-protector \
$(NULL)

vainfo_libs = \
Expand Down
2 changes: 2 additions & 0 deletions videoprocess/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
bin_PROGRAMS = vavpp

AM_CPPFLAGS = \
-Wall \
-fstack-protector \
$(LIBVA_CFLAGS) \
-I$(top_srcdir)/common \
$(NULL)
Expand Down
Loading

0 comments on commit 1bea64e

Please sign in to comment.