1/*
2 INTEL CONFIDENTIAL
3 Copyright 2009 Intel Corporation All Rights Reserved.
4 The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licensors. The Material contains trade secrets and proprietary and confidential information of Intel or its suppliers and licensors. The Material is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without Intel’s prior express written permission.
5
6 No license under any patent, copyright, trade secret or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual property rights must be express and approved by Intel in writing.
7 */
8
9#ifndef VBP_UTILS_H
10#define VBP_UTILS_H
11
12#include "viddec_parser_ops.h"
13#include "viddec_pm_parse.h"
14#include "viddec_pm.h"
15#include "vbp_trace.h"
16
17#define MAGIC_NUMBER 0x0DEADBEEF
18#define MAX_WORKLOAD_ITEMS 1000
19
20/* maximum 256 slices per sample buffer */
21#define MAX_NUM_SLICES 256
22
23/* maximum two pictures per sample buffer */
24#define MAX_NUM_PICTURES 2
25
26
27extern uint32 viddec_parse_sc(void *in, void *pcxt, void *sc_state);
28
29/* rolling counter of sample buffer */
30extern uint32 buffer_counter;
31
32typedef struct vbp_context_t vbp_context;
33
34typedef uint32 (*function_init_parser_entries)(vbp_context* cxt);
35typedef uint32 (*function_allocate_query_data)(vbp_context* cxt);
36typedef uint32 (*function_free_query_data)(vbp_context* cxt);
37typedef uint32 (*function_parse_init_data)(vbp_context* cxt);
38typedef uint32 (*function_parse_start_code)(vbp_context* cxt);
39typedef uint32 (*function_process_parsing_result)(vbp_context* cxt, int i);
40typedef uint32 (*function_populate_query_data)(vbp_context* cxt);
41
42
43
44struct vbp_context_t
45{
46	/* magic number */
47	uint32 identifier;
48
49	/* parser type, eg, MPEG-2, MPEG-4, H.264, VC1 */
50	uint32 parser_type;
51
52	/* handle to parser (shared object) */
53	void *fd_parser;
54
55	/* parser (shared object) entry points */
56	viddec_parser_ops_t *parser_ops;
57
58	/* parser context */
59	viddec_pm_cxt_t *parser_cxt;
60
61	/* work load */
62	viddec_workload_t *workload1, *workload2;
63
64	/* persistent memory for parser */
65	uint32 *persist_mem;
66
67	/* format specific query data */
68	void *query_data;
69
70
71	function_init_parser_entries 	func_init_parser_entries;
72	function_allocate_query_data 	func_allocate_query_data;
73	function_free_query_data 		func_free_query_data;
74	function_parse_init_data 		func_parse_init_data;
75	function_parse_start_code 		func_parse_start_code;
76	function_process_parsing_result func_process_parsing_result;
77	function_populate_query_data 	func_populate_query_data;
78
79};
80
81/**
82 * create VBP context
83 */
84uint32 vbp_utils_create_context(uint32 parser_type, vbp_context **ppcontext);
85
86/*
87 * destroy VBP context
88 */
89uint32 vbp_utils_destroy_context(vbp_context *pcontext);
90
91/*
92 * parse bitstream
93 */
94uint32 vbp_utils_parse_buffer(vbp_context *pcontext, uint8 *data, uint32 size, uint8 init_data_flag);
95
96/*
97 * query parsing result
98 */
99uint32 vbp_utils_query(vbp_context *pcontext, void **data);
100
101/*
102 * flush un-parsed bitstream
103 */
104uint32 vbp_utils_flush(vbp_context *pcontext);
105
106#endif /* VBP_UTILS_H */
107