Dirac - A Video Codec

Created by the British Broadcasting Corporation.


dirac_encoder.h

Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002 *
00003 * $Id: dirac_encoder.h,v 1.19 2007/12/05 01:42:40 asuraparaju Exp $ $Name: Dirac_0_9_0 $
00004 *
00005 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006 *
00007 * The contents of this file are subject to the Mozilla Public License
00008 * Version 1.1 (the "License"); you may not use this file except in compliance
00009 * with the License. You may obtain a copy of the License at
00010 * http://www.mozilla.org/MPL/
00011 *
00012 * Software distributed under the License is distributed on an "AS IS" basis,
00013 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
00014 * the specific language governing rights and limitations under the License.
00015 *
00016 * The Original Code is BBC Research and Development code.
00017 *
00018 * The Initial Developer of the Original Code is the British Broadcasting
00019 * Corporation.
00020 * Portions created by the Initial Developer are Copyright (C) 2004.
00021 * All Rights Reserved.
00022 *
00023 * Contributor(s): Anuradha Suraparaju (Original Author)
00024 *                 Andrew Kennedy,
00025 *                 Thomas Davies
00026 *                 Myo Tun (Brunel University, myo.tun@brunel.ac.uk)                  
00027 *
00028 * Alternatively, the contents of this file may be used under the terms of
00029 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
00030 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
00031 * the GPL or the LGPL are applicable instead of those above. If you wish to
00032 * allow use of your version of this file only under the terms of the either
00033 * the GPL or LGPL and not to allow others to use your version of this file
00034 * under the MPL, indicate your decision by deleting the provisions above
00035 * and replace them with the notice and other provisions required by the GPL
00036 * or LGPL. If you do not delete the provisions above, a recipient may use
00037 * your version of this file under the terms of any one of the MPL, the GPL
00038 * or the LGPL.
00039 * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef DIRAC_ENCODER_H
00042 #define DIRAC_ENCODER_H
00043 
00044 #include <libdirac_common/dirac_types.h>
00045 
00144 #ifdef __cplusplus
00145 extern "C" {
00146 #endif
00147 
00149 typedef enum
00150 { 
00151     ENC_STATE_INVALID = -1, 
00152     ENC_STATE_BUFFER, 
00153     ENC_STATE_AVAIL
00154 } dirac_encoder_state_t ;
00155 
00158 typedef VideoFormat dirac_encoder_presets_t;
00159 
00162 typedef MVPrecisionType dirac_mvprecision_t;
00163 
00165 typedef struct 
00166 {
00168     int lossless;
00170     float qf;
00172     int full_search;
00174     int x_range_me;
00176     int y_range_me;
00178     int L1_sep;
00182     int num_L1;
00184     float cpd;
00186     int xblen;
00188     int yblen;
00190     int xbsep;
00192     int ybsep;
00194     int video_format;
00196     dirac_wlt_filter_t intra_wlt_filter;
00198     dirac_wlt_filter_t inter_wlt_filter;
00200     unsigned int wlt_depth;
00202     unsigned int spatial_partition;
00204     unsigned int denoise;
00206     unsigned int multi_quants;
00208     dirac_mvprecision_t mv_precision;
00210     int trate;
00212     unsigned int picture_coding_mode;
00214     int using_ac;
00215 } dirac_encparams_t;
00216 
00218 typedef struct
00219 {
00221     dirac_sourceparams_t src_params;
00223     dirac_encparams_t enc_params;
00225     int instr_flag;
00228     int decode_flag;
00229 } dirac_encoder_context_t;
00230 
00243 extern DllExport void dirac_encoder_context_init (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset);
00244 
00245 
00247 typedef struct
00248 {
00250     unsigned char *buffer;
00252     int size;
00253 } dirac_enc_data_t;
00254 
00256 typedef struct
00257 {
00259     unsigned int mv_bits;
00261     unsigned int ycomp_bits;
00263     unsigned int ucomp_bits;
00265     unsigned int vcomp_bits;
00267     unsigned int frame_bits;
00268 } dirac_enc_framestats_t;
00269 
00271 typedef struct
00272 {
00274     unsigned int mv_bits;
00276     unsigned int seq_bits;
00278     unsigned int ycomp_bits;
00280     unsigned int ucomp_bits;
00282     unsigned int vcomp_bits;
00284     unsigned int bit_rate;
00285 } dirac_enc_seqstats_t;
00286 
00288 typedef struct
00289 {
00291     int x;
00293     int y;
00294 } dirac_mv_t;
00295 
00297 typedef struct
00298 {
00300     float SAD;
00302     float mvcost;
00303 } dirac_mv_cost_t;
00304 
00306 typedef struct
00307 {
00309     dirac_frame_type_t ftype;
00311     dirac_reference_type_t rtype;
00313     int fnum;
00315     int num_refs;
00317     int refs[2];
00319     int xbsep;
00321     int ybsep;
00323     int mb_xlen;
00325     int mb_ylen;
00327     int mv_xlen;
00329     int mv_ylen;
00331     int *mb_split_mode;
00333     float *mb_costs;
00335     int *pred_mode;
00337     float *intra_costs;
00339     dirac_mv_cost_t *bipred_costs;
00341     short *dc_ycomp;
00343     short *dc_ucomp;
00345     short *dc_vcomp;
00347     dirac_mv_t *mv[2];
00349     dirac_mv_cost_t *pred_costs[2];
00350 } dirac_instr_t;
00351 
00353 typedef struct
00354 {
00356     dirac_encoder_context_t enc_ctx;
00357 
00359     int encoded_frame_avail;
00360 
00365     dirac_enc_data_t enc_buf;
00366 
00368     dirac_frameparams_t enc_fparams;
00369 
00371     dirac_enc_framestats_t enc_fstats;
00372 
00374     dirac_enc_seqstats_t enc_seqstats;
00375 
00377     int end_of_sequence;
00378 
00379     /* locally decoded frame available flag. 
00380        1 - locally decoded frame available in dec_buf. 
00381        0 - locally decoded frame not available.
00382     */
00383     int decoded_frame_avail;
00384 
00389     dirac_framebuf_t dec_buf;
00390 
00392     dirac_frameparams_t dec_fparams;
00393 
00397     dirac_instr_t instr;
00398 
00403     int instr_data_avail;
00404 
00406     const void *compressor;
00407 } dirac_encoder_t;
00408 
00415 extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose);
00416 
00426 extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size);
00427 
00437 extern DllExport dirac_encoder_state_t dirac_encoder_output (dirac_encoder_t *encoder);
00438 
00446 extern DllExport int dirac_encoder_end_sequence (dirac_encoder_t *encoder);
00447 
00452 extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder);
00453 
00454 #endif
00455 #ifdef __cplusplus
00456 }
00457 #endif

© 2004 British Broadcasting Corporation. Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.