diff options
author | Zhao, Yakui <yakui.zhao@intel.com> | 2014-05-26 08:40:15 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2014-06-16 11:53:35 +0800 |
commit | 558e904bc5c471795b09f6c2dcf65ba31590b19b (patch) | |
tree | 7d2fc77867518be9ad45779b50cb09ced4b59013 | |
parent | 772e94298f2fc42da1f9be69de80664d9055b685 (diff) | |
download | libva-intel-driver-558e904bc5c471795b09f6c2dcf65ba31590b19b.tar.gz libva-intel-driver-558e904bc5c471795b09f6c2dcf65ba31590b19b.tar.bz2 libva-intel-driver-558e904bc5c471795b09f6c2dcf65ba31590b19b.zip |
H264_Encoding: Prepare some data structures for adding packed raw data
Under some encoding scenario, the user-space application hopes that the driver
can insert the passed packed rawdata into the coded clip. But the insertion of
packed rawdata is related with the slice. So some data structures are added so
that it can store how the packed rawdata is inserted into the coded clip
per-slice.
Signed-off-by: Zhao, Yakui <yakui.zhao@intel.com>
(cherry picked from commit 65727b1868f01d836659396724b83d2992656242)
-rwxr-xr-x | src/i965_drv_video.c | 43 | ||||
-rw-r--r-- | src/i965_drv_video.h | 20 |
2 files changed, 63 insertions, 0 deletions
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index eba9a47..db0440c 100755 --- a/src/i965_drv_video.c +++ b/src/i965_drv_video.c @@ -1636,6 +1636,22 @@ i965_destroy_context(struct object_heap *heap, struct object_base *obj) i965_release_buffer_store(&obj_context->codec_state.encode.slice_params_ext[i]); free(obj_context->codec_state.encode.slice_params_ext); + if (obj_context->codec_state.encode.slice_rawdata_index) { + free(obj_context->codec_state.encode.slice_rawdata_index); + obj_context->codec_state.encode.slice_rawdata_index = NULL; + } + if (obj_context->codec_state.encode.slice_rawdata_count) { + free(obj_context->codec_state.encode.slice_rawdata_count); + obj_context->codec_state.encode.slice_rawdata_count = NULL; + } + for (i = 0; i < obj_context->codec_state.encode.num_packed_header_params_ext; i++) + i965_release_buffer_store(&obj_context->codec_state.encode.packed_header_params_ext[i]); + free(obj_context->codec_state.encode.packed_header_params_ext); + + for (i = 0; i < obj_context->codec_state.encode.num_packed_header_data_ext; i++) + i965_release_buffer_store(&obj_context->codec_state.encode.packed_header_data_ext[i]); + free(obj_context->codec_state.encode.packed_header_data_ext); + } else { assert(obj_context->codec_state.decode.num_slice_params <= obj_context->codec_state.decode.max_slice_params); assert(obj_context->codec_state.decode.num_slice_datas <= obj_context->codec_state.decode.max_slice_datas); @@ -1754,6 +1770,22 @@ i965_CreateContext(VADriverContextP ctx, obj_context->codec_state.encode.max_slice_params = NUM_SLICES; obj_context->codec_state.encode.slice_params = calloc(obj_context->codec_state.encode.max_slice_params, sizeof(*obj_context->codec_state.encode.slice_params)); + obj_context->codec_state.encode.max_packed_header_params_ext = NUM_SLICES; + obj_context->codec_state.encode.packed_header_params_ext = + calloc(obj_context->codec_state.encode.max_packed_header_params_ext, + sizeof(struct buffer_store *)); + + obj_context->codec_state.encode.max_packed_header_data_ext = NUM_SLICES; + obj_context->codec_state.encode.packed_header_data_ext = + calloc(obj_context->codec_state.encode.max_packed_header_data_ext, + sizeof(struct buffer_store *)); + + obj_context->codec_state.encode.slice_num = NUM_SLICES; + obj_context->codec_state.encode.slice_rawdata_index = + calloc(obj_context->codec_state.encode.slice_num, sizeof(int)); + obj_context->codec_state.encode.slice_rawdata_count = + calloc(obj_context->codec_state.encode.slice_num, sizeof(int)); + assert(i965->codec_info->enc_hw_context_init); obj_context->hw_context = i965->codec_info->enc_hw_context_init(ctx, obj_config); } else { @@ -2187,6 +2219,17 @@ i965_BeginPicture(VADriverContextP ctx, obj_context->codec_state.encode.num_slice_params_ext = 0; obj_context->codec_state.encode.current_render_target = render_target; /*This is input new frame*/ obj_context->codec_state.encode.last_packed_header_type = 0; + memset(obj_context->codec_state.encode.slice_rawdata_index, 0, + sizeof(int) * obj_context->codec_state.encode.slice_num); + memset(obj_context->codec_state.encode.slice_rawdata_count, 0, + sizeof(int) * obj_context->codec_state.encode.slice_num); + + for (i = 0; i < obj_context->codec_state.encode.num_packed_header_params_ext; i++) + i965_release_buffer_store(&obj_context->codec_state.encode.packed_header_params_ext[i]); + for (i = 0; i < obj_context->codec_state.encode.num_packed_header_data_ext; i++) + i965_release_buffer_store(&obj_context->codec_state.encode.packed_header_data_ext[i]); + obj_context->codec_state.encode.num_packed_header_params_ext = 0; + obj_context->codec_state.encode.num_packed_header_data_ext = 0; } else { obj_context->codec_state.decode.current_render_target = render_target; i965_release_buffer_store(&obj_context->codec_state.decode.pic_param); diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h index 95ee193..9827209 100644 --- a/src/i965_drv_video.h +++ b/src/i965_drv_video.h @@ -125,6 +125,9 @@ struct decode_state struct object_surface *reference_objects[16]; /* Up to 2 reference surfaces are valid for MPEG-2,*/ }; +#define SLICE_PACKED_DATA_INDEX_TYPE 0x80000000 +#define SLICE_PACKED_DATA_INDEX_MASK 0x00FFFFFF + struct encode_state { struct codec_state_base base; @@ -145,6 +148,23 @@ struct encode_state struct buffer_store **slice_params_ext; int max_slice_params_ext; int num_slice_params_ext; + + /* For the packed data that needs to be inserted into video clip */ + /* currently it is mainly for packed raw data */ + struct buffer_store **packed_header_params_ext; + int max_packed_header_params_ext; + int num_packed_header_params_ext; + struct buffer_store **packed_header_data_ext; + int max_packed_header_data_ext; + int num_packed_header_data_ext; + + /* the array is determined by max_slice_params_ext */ + int slice_num; + /* This is to store the first index of packed data for one slice */ + int *slice_rawdata_index; + /* This is to store the number of packed data for one slice */ + int *slice_rawdata_count; + int last_packed_header_type; struct buffer_store *misc_param[16]; |