[Libva] [PATCH 1/2] test/encode: remove unused variables and functions

Kelley, Sean V sean.v.kelley at intel.com
Wed Sep 16 18:02:01 PDT 2015


On Thu, 2015-09-17 at 08:54 +0800, Zhao Yakui wrote:


On 09/17/2015 12:12 AM, U. Artie Eoff wrote:
> This gets rid of compiler warnings caused by various unused
> variables and functions.

The variables are not used and it is OK to remove them for fixing the
compiler warnings.

This patch looks good to me.


Yes, this looks good.

Applied.

Sean




>
> Signed-off-by: U. Artie Eoff<ullysses.a.eoff at intel.com<mailto:ullysses.a.eoff at intel.com>>
> ---
>   test/encode/avcenc.c     | 44 ++------------------------------------------
>   test/encode/mpeg2vaenc.c |  1 -
>   test/loadsurface.h       | 24 ++++--------------------
>   3 files changed, 6 insertions(+), 63 deletions(-)
>
> diff --git a/test/encode/avcenc.c b/test/encode/avcenc.c
> index d41fb1be9aa1..dd00e496a2c6 100644
> --- a/test/encode/avcenc.c
> +++ b/test/encode/avcenc.c
> @@ -96,7 +96,6 @@ static int ip_period = 1;
>
>
>   static  unsigned int MaxFrameNum = (1<<12);
> -static  unsigned int MaxPicOrderCntLsb = (1<<8);
>   static  unsigned int Log2MaxFrameNum = 12;
>   static  unsigned int Log2MaxPicOrderCntLsb = 8;
>
> @@ -470,38 +469,6 @@ static int update_RefPicList()
>       return 0;
>   }
>
> -static int calc_poc(int pic_order_cnt_lsb)
> -{
> -    static int PicOrderCntMsb_ref = 0, pic_order_cnt_lsb_ref = 0;
> -    int prevPicOrderCntMsb, prevPicOrderCntLsb;
> -    int PicOrderCntMsb, TopFieldOrderCnt;
> -
> -    if (current_frame_type == FRAME_IDR)
> -        prevPicOrderCntMsb = prevPicOrderCntLsb = 0;
> -    else {
> -        prevPicOrderCntMsb = PicOrderCntMsb_ref;
> -        prevPicOrderCntLsb = pic_order_cnt_lsb_ref;
> -    }
> -
> -    if ((pic_order_cnt_lsb<  prevPicOrderCntLsb)&&
> -        ((prevPicOrderCntLsb - pic_order_cnt_lsb)>= (int)(MaxPicOrderCntLsb / 2)))
> -        PicOrderCntMsb = prevPicOrderCntMsb + MaxPicOrderCntLsb;
> -    else if ((pic_order_cnt_lsb>  prevPicOrderCntLsb)&&
> -             ((pic_order_cnt_lsb - prevPicOrderCntLsb)>  (int)(MaxPicOrderCntLsb / 2)))
> -        PicOrderCntMsb = prevPicOrderCntMsb - MaxPicOrderCntLsb;
> -    else
> -        PicOrderCntMsb = prevPicOrderCntMsb;
> -
> -    TopFieldOrderCnt = PicOrderCntMsb + pic_order_cnt_lsb;
> -
> -    if (current_frame_type != SLICE_TYPE_B) {
> -        PicOrderCntMsb_ref = PicOrderCntMsb;
> -        pic_order_cnt_lsb_ref = pic_order_cnt_lsb;
> -    }
> -
> -    return TopFieldOrderCnt;
> -}
> -
>   static void avcenc_update_picture_parameter(int slice_type, int is_idr)
>   {
>       VAEncPictureParameterBufferH264 *pic_param;
> @@ -742,7 +709,7 @@ static int begin_picture(FILE *yuv_fp, int frame_num, int display_num, int slice
>           fprintf(stderr, "FATAL error!!!\n");
>           exit(1);
>       }
> -
> +
>       pthread_join(avcenc_context.upload_thread_id, NULL);
>
>       avcenc_context.upload_thread_value = -1;
> @@ -754,12 +721,11 @@ static int begin_picture(FILE *yuv_fp, int frame_num, int display_num, int slice
>
>       if (is_idr) {
>           VAEncPackedHeaderParameterBuffer packed_header_param_buffer;
> -        unsigned int length_in_bits, offset_in_bytes;
> +        unsigned int length_in_bits;
>           unsigned char *packed_seq_buffer = NULL, *packed_pic_buffer = NULL;
>
>           assert(slice_type == SLICE_TYPE_I);
>           length_in_bits = build_packed_seq_buffer(&packed_seq_buffer);
> -        offset_in_bytes = 0;
>           packed_header_param_buffer.type = VAEncPackedHeaderSequence;
>           packed_header_param_buffer.bit_length = length_in_bits;
>           packed_header_param_buffer.has_emulation_bytes = 0;
> @@ -778,7 +744,6 @@ static int begin_picture(FILE *yuv_fp, int frame_num, int display_num, int slice
>           CHECK_VASTATUS(va_status,"vaCreateBuffer");
>
>           length_in_bits = build_packed_pic_buffer(&packed_pic_buffer);
> -        offset_in_bytes = 0;
>           packed_header_param_buffer.type = VAEncPackedHeaderPicture;
>           packed_header_param_buffer.bit_length = length_in_bits;
>           packed_header_param_buffer.has_emulation_bytes = 0;
> @@ -1802,12 +1767,7 @@ static void avcenc_context_pic_param_init(VAEncPictureParameterBufferH264 *pic_p
>
>   static void avcenc_context_sei_init()
>   {
> -     int init_cpb_size;
> -     int target_bit_rate;
> -
>       /* it comes for the bps defined in SPS */
> -     target_bit_rate = avcenc_context.seq_param.bits_per_second;
> -     init_cpb_size = (target_bit_rate * 8)>>  10;
>       avcenc_context.i_initial_cpb_removal_delay = 2 * 90000;
>       avcenc_context.i_initial_cpb_removal_delay_offset = 2 * 90000;
>
> diff --git a/test/encode/mpeg2vaenc.c b/test/encode/mpeg2vaenc.c
> index dc1c7f09a803..f49af27b3764 100644
> --- a/test/encode/mpeg2vaenc.c
> +++ b/test/encode/mpeg2vaenc.c
> @@ -330,7 +330,6 @@ pps_rbsp(const VAEncSequenceParameterBufferMPEG2 *seq_param,
>            const VAEncPictureParameterBufferMPEG2 *pic_param,
>            bitstream *bs)
>   {
> -    int i;
>       int chroma_420_type;
>
>       if (seq_param->sequence_extension.bits.chroma_format == CHROMA_FORMAT_420)
> diff --git a/test/loadsurface.h b/test/loadsurface.h
> index 119db9750c34..a4cdb9d46ce6 100755
> --- a/test/loadsurface.h
> +++ b/test/loadsurface.h
> @@ -297,8 +297,8 @@ static int upload_surface_yuv(VADisplay va_dpy, VASurfaceID surface_id,
>                                 unsigned char *src_Y, unsigned char *src_U, unsigned char *src_V)
>   {
>       VAImage surface_image;
> -    unsigned char *surface_p=NULL, *Y_start=NULL, *U_start=NULL, *V_start=NULL;
> -    int Y_pitch=0, U_pitch=0, V_pitch=0, row;
> +    unsigned char *surface_p=NULL, *Y_start=NULL, *U_start=NULL;
> +    int Y_pitch=0, U_pitch=0, row;
>       VAStatus va_status;
>
>       va_status = vaDeriveImage(va_dpy,surface_id,&surface_image);
> @@ -312,27 +312,19 @@ static int upload_surface_yuv(VADisplay va_dpy, VASurfaceID surface_id,
>       switch (surface_image.format.fourcc) {
>       case VA_FOURCC_NV12:
>           U_start = (unsigned char *)surface_p + surface_image.offsets[1];
> -        V_start = U_start + 1;
>           U_pitch = surface_image.pitches[1];
> -        V_pitch = surface_image.pitches[1];
>           break;
>       case VA_FOURCC_IYUV:
>           U_start = (unsigned char *)surface_p + surface_image.offsets[1];
> -        V_start = (unsigned char *)surface_p + surface_image.offsets[2];
>           U_pitch = surface_image.pitches[1];
> -        V_pitch = surface_image.pitches[2];
>           break;
>       case VA_FOURCC_YV12:
>           U_start = (unsigned char *)surface_p + surface_image.offsets[2];
> -        V_start = (unsigned char *)surface_p + surface_image.offsets[1];
>           U_pitch = surface_image.pitches[2];
> -        V_pitch = surface_image.pitches[1];
>           break;
>       case VA_FOURCC_YUY2:
>           U_start = surface_p + 1;
> -        V_start = surface_p + 3;
>           U_pitch = surface_image.pitches[0];
> -        V_pitch = surface_image.pitches[0];
>           break;
>       default:
>           assert(0);
> @@ -395,8 +387,8 @@ static int download_surface_yuv(VADisplay va_dpy, VASurfaceID surface_id,
>                                   unsigned char *dst_Y, unsigned char *dst_U, unsigned char *dst_V)
>   {
>       VAImage surface_image;
> -    unsigned char *surface_p=NULL, *Y_start=NULL, *U_start=NULL,*V_start=NULL;
> -    int Y_pitch=0, U_pitch=0, V_pitch=0, row;
> +    unsigned char *surface_p=NULL, *Y_start=NULL, *U_start=NULL;
> +    int Y_pitch=0, U_pitch=0, row;
>       VAStatus va_status;
>
>       va_status = vaDeriveImage(va_dpy,surface_id,&surface_image);
> @@ -410,27 +402,19 @@ static int download_surface_yuv(VADisplay va_dpy, VASurfaceID surface_id,
>       switch (surface_image.format.fourcc) {
>       case VA_FOURCC_NV12:
>           U_start = (unsigned char *)surface_p + surface_image.offsets[1];
> -        V_start = U_start + 1;
>           U_pitch = surface_image.pitches[1];
> -        V_pitch = surface_image.pitches[1];
>           break;
>       case VA_FOURCC_IYUV:
>           U_start = (unsigned char *)surface_p + surface_image.offsets[1];
> -        V_start = (unsigned char *)surface_p + surface_image.offsets[2];
>           U_pitch = surface_image.pitches[1];
> -        V_pitch = surface_image.pitches[2];
>           break;
>       case VA_FOURCC_YV12:
>           U_start = (unsigned char *)surface_p + surface_image.offsets[2];
> -        V_start = (unsigned char *)surface_p + surface_image.offsets[1];
>           U_pitch = surface_image.pitches[2];
> -        V_pitch = surface_image.pitches[1];
>           break;
>       case VA_FOURCC_YUY2:
>           U_start = surface_p + 1;
> -        V_start = surface_p + 3;
>           U_pitch = surface_image.pitches[0];
> -        V_pitch = surface_image.pitches[0];
>           break;
>       default:
>           assert(0);

_______________________________________________
Libva mailing list
Libva at lists.freedesktop.org<mailto:Libva at lists.freedesktop.org>
http://lists.freedesktop.org/mailman/listinfo/libva





More information about the Libva mailing list