[Libva] [PATCH 2/2] test/encode: remove dead code

U. Artie Eoff ullysses.a.eoff at intel.com
Wed Sep 16 09:12:46 PDT 2015


Remove commented code and their functions that are no
longer executed.  This erradicates some compiler warnings
for unused functions.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
---
 test/encode/h264encode.c | 171 -----------------------------------------------
 1 file changed, 171 deletions(-)

diff --git a/test/encode/h264encode.c b/test/encode/h264encode.c
index ce96f92d8a39..4dfc036bcb48 100644
--- a/test/encode/h264encode.c
+++ b/test/encode/h264encode.c
@@ -563,72 +563,6 @@ build_packed_seq_buffer(unsigned char **header_buffer)
     return bs.bit_offset;
 }
 
-static int 
-build_packed_sei_buffer_timing(unsigned int init_cpb_removal_length,
-				unsigned int init_cpb_removal_delay,
-				unsigned int init_cpb_removal_delay_offset,
-				unsigned int cpb_removal_length,
-				unsigned int cpb_removal_delay,
-				unsigned int dpb_output_length,
-				unsigned int dpb_output_delay,
-				unsigned char **sei_buffer)
-{
-    unsigned char *byte_buf;
-    int bp_byte_size, i, pic_byte_size;
-
-    bitstream nal_bs;
-    bitstream sei_bp_bs, sei_pic_bs;
-
-    bitstream_start(&sei_bp_bs);
-    bitstream_put_ue(&sei_bp_bs, 0);       /*seq_parameter_set_id*/
-    bitstream_put_ui(&sei_bp_bs, init_cpb_removal_delay, cpb_removal_length); 
-    bitstream_put_ui(&sei_bp_bs, init_cpb_removal_delay_offset, cpb_removal_length); 
-    if ( sei_bp_bs.bit_offset & 0x7) {
-        bitstream_put_ui(&sei_bp_bs, 1, 1);
-    }
-    bitstream_end(&sei_bp_bs);
-    bp_byte_size = (sei_bp_bs.bit_offset + 7) / 8;
-    
-    bitstream_start(&sei_pic_bs);
-    bitstream_put_ui(&sei_pic_bs, cpb_removal_delay, cpb_removal_length); 
-    bitstream_put_ui(&sei_pic_bs, dpb_output_delay, dpb_output_length); 
-    if ( sei_pic_bs.bit_offset & 0x7) {
-        bitstream_put_ui(&sei_pic_bs, 1, 1);
-    }
-    bitstream_end(&sei_pic_bs);
-    pic_byte_size = (sei_pic_bs.bit_offset + 7) / 8;
-    
-    bitstream_start(&nal_bs);
-    nal_start_code_prefix(&nal_bs);
-    nal_header(&nal_bs, NAL_REF_IDC_NONE, NAL_SEI);
-
-	/* Write the SEI buffer period data */    
-    bitstream_put_ui(&nal_bs, 0, 8);
-    bitstream_put_ui(&nal_bs, bp_byte_size, 8);
-    
-    byte_buf = (unsigned char *)sei_bp_bs.buffer;
-    for(i = 0; i < bp_byte_size; i++) {
-        bitstream_put_ui(&nal_bs, byte_buf[i], 8);
-    }
-    free(byte_buf);
-	/* write the SEI timing data */
-    bitstream_put_ui(&nal_bs, 0x01, 8);
-    bitstream_put_ui(&nal_bs, pic_byte_size, 8);
-    
-    byte_buf = (unsigned char *)sei_pic_bs.buffer;
-    for(i = 0; i < pic_byte_size; i++) {
-        bitstream_put_ui(&nal_bs, byte_buf[i], 8);
-    }
-    free(byte_buf);
-
-    rbsp_trailing_bits(&nal_bs);
-    bitstream_end(&nal_bs);
-
-    *sei_buffer = (unsigned char *)nal_bs.buffer; 
-   
-    return nal_bs.bit_offset;
-}
-
 static int build_packed_slice_buffer(unsigned char **header_buffer)
 {
     bitstream bs;
@@ -1662,105 +1596,6 @@ static int render_packedpicture(void)
     return 0;
 }
 
-static void render_packedsei(void)
-{
-    VAEncPackedHeaderParameterBuffer packed_header_param_buffer;
-    VABufferID packed_sei_header_param_buf_id, packed_sei_buf_id, render_id[2];
-    unsigned int length_in_bits /*offset_in_bytes*/;
-    unsigned char *packed_sei_buffer = NULL;
-    VAStatus va_status;
-    int init_cpb_size, target_bit_rate, i_initial_cpb_removal_delay_length, i_initial_cpb_removal_delay;
-    int i_cpb_removal_delay, i_dpb_output_delay_length, i_cpb_removal_delay_length;
-
-    /* it comes for the bps defined in SPS */
-    target_bit_rate = frame_bitrate;
-    init_cpb_size = (target_bit_rate * 8) >> 10;
-    i_initial_cpb_removal_delay = init_cpb_size * 0.5 * 1024 / target_bit_rate * 90000;
-
-    i_cpb_removal_delay = 2;
-    i_initial_cpb_removal_delay_length = 24;
-    i_cpb_removal_delay_length = 24;
-    i_dpb_output_delay_length = 24;
-    
-
-    length_in_bits = build_packed_sei_buffer_timing(
-        i_initial_cpb_removal_delay_length,
-        i_initial_cpb_removal_delay,
-        0,
-        i_cpb_removal_delay_length,
-        i_cpb_removal_delay * current_frame_encoding,
-        i_dpb_output_delay_length,
-        0,
-        &packed_sei_buffer);
-
-    //offset_in_bytes = 0;
-    packed_header_param_buffer.type = VAEncPackedHeaderH264_SEI;
-    packed_header_param_buffer.bit_length = length_in_bits;
-    packed_header_param_buffer.has_emulation_bytes = 0;
-
-    va_status = vaCreateBuffer(va_dpy,
-                               context_id,
-                               VAEncPackedHeaderParameterBufferType,
-                               sizeof(packed_header_param_buffer), 1, &packed_header_param_buffer,
-                               &packed_sei_header_param_buf_id);
-    CHECK_VASTATUS(va_status,"vaCreateBuffer");
-
-    va_status = vaCreateBuffer(va_dpy,
-                               context_id,
-                               VAEncPackedHeaderDataBufferType,
-                               (length_in_bits + 7) / 8, 1, packed_sei_buffer,
-                               &packed_sei_buf_id);
-    CHECK_VASTATUS(va_status,"vaCreateBuffer");
-
-
-    render_id[0] = packed_sei_header_param_buf_id;
-    render_id[1] = packed_sei_buf_id;
-    va_status = vaRenderPicture(va_dpy,context_id, render_id, 2);
-    CHECK_VASTATUS(va_status,"vaRenderPicture");
-
-    
-    free(packed_sei_buffer);
-        
-    return;
-}
-
-
-static int render_hrd(void)
-{
-    VABufferID misc_parameter_hrd_buf_id;
-    VAStatus va_status;
-    VAEncMiscParameterBuffer *misc_param;
-    VAEncMiscParameterHRD *misc_hrd_param;
-    
-    va_status = vaCreateBuffer(va_dpy, context_id,
-                   VAEncMiscParameterBufferType,
-                   sizeof(VAEncMiscParameterBuffer) + sizeof(VAEncMiscParameterHRD),
-                   1,
-                   NULL, 
-                   &misc_parameter_hrd_buf_id);
-    CHECK_VASTATUS(va_status, "vaCreateBuffer");
-
-    vaMapBuffer(va_dpy,
-                misc_parameter_hrd_buf_id,
-                (void **)&misc_param);
-    misc_param->type = VAEncMiscParameterTypeHRD;
-    misc_hrd_param = (VAEncMiscParameterHRD *)misc_param->data;
-
-    if (frame_bitrate > 0) {
-        misc_hrd_param->initial_buffer_fullness = frame_bitrate * 1024 * 4;
-        misc_hrd_param->buffer_size = frame_bitrate * 1024 * 8;
-    } else {
-        misc_hrd_param->initial_buffer_fullness = 0;
-        misc_hrd_param->buffer_size = 0;
-    }
-    vaUnmapBuffer(va_dpy, misc_parameter_hrd_buf_id);
-
-    va_status = vaRenderPicture(va_dpy,context_id, &misc_parameter_hrd_buf_id, 1);
-    CHECK_VASTATUS(va_status,"vaRenderPicture");;
-
-    return 0;
-}
-
 static void render_packedslice()
 {
     VAEncPackedHeaderParameterBuffer packedheader_param_buffer;
@@ -2180,15 +2015,9 @@ static int encode_frames(void)
                 render_packedsequence();
                 render_packedpicture();
             }
-            //if (rc_mode == VA_RC_CBR)
-            //    render_packedsei();
-            //render_hrd();
         } else {
             //render_sequence();
             render_picture();
-            //if (rc_mode == VA_RC_CBR)
-            //    render_packedsei();
-            //render_hrd();
         }
         render_slice();
         RenderPictureTicks += GetTickCount() - tmp;
-- 
2.1.0



More information about the Libva mailing list