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.11 2006/11/23 16:22:16 tjdwave Exp $ $Name:  $
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 *
00027 * Alternatively, the contents of this file may be used under the terms of
00028 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
00029 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
00030 * the GPL or the LGPL are applicable instead of those above. If you wish to
00031 * allow use of your version of this file only under the terms of the either
00032 * the GPL or LGPL and not to allow others to use your version of this file
00033 * under the MPL, indicate your decision by deleting the provisions above
00034 * and replace them with the notice and other provisions required by the GPL
00035 * or LGPL. If you do not delete the provisions above, a recipient may use
00036 * your version of this file under the terms of any one of the MPL, the GPL
00037 * or the LGPL.
00038 * ***** END LICENSE BLOCK ***** */
00039 
00040 #ifndef DIRAC_ENCODER_H
00041 #define DIRAC_ENCODER_H
00042 
00043 #include <libdirac_common/dirac_types.h>
00044 
00143 #ifdef __cplusplus
00144 extern "C" {
00145 #endif
00146 
00148 typedef enum
00149 { 
00150     ENC_STATE_INVALID = -1, 
00151     ENC_STATE_BUFFER, 
00152     ENC_STATE_AVAIL
00153 } dirac_encoder_state_t ;
00154 
00157 typedef VideoFormat dirac_encoder_presets_t;
00158 
00161 typedef MVPrecisionType dirac_mvprecision_t;
00162 
00164 typedef struct 
00165 {
00167     int lossless;
00169     float qf;
00171     int L1_sep;
00175     int num_L1;
00177     float cpd;
00179     int xblen;
00181     int yblen;
00183     int xbsep;
00185     int ybsep;
00187     int video_format;
00189     dirac_wlt_filter_t intra_wlt_filter;
00191     dirac_wlt_filter_t inter_wlt_filter;
00193     unsigned int wlt_depth;
00195     unsigned int spatial_partition;
00197     unsigned int denoise;
00199     unsigned int def_spatial_partition;
00201     unsigned int multi_quants;
00203     dirac_mvprecision_t mv_precision;
00204 } dirac_encparams_t;
00205 
00207 typedef struct
00208 {
00210     dirac_seqparams_t seq_params;
00212     dirac_sourceparams_t src_params;
00214     dirac_encparams_t enc_params;
00216     int instr_flag;
00219     int decode_flag;
00220 } dirac_encoder_context_t;
00221 
00308 extern DllExport void dirac_encoder_context_init (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset);
00309 
00310 
00312 typedef struct
00313 {
00315     unsigned char *buffer;
00317     int size;
00318 } dirac_enc_data_t;
00319 
00321 typedef struct
00322 {
00324     unsigned int mv_bits;
00326     unsigned int ycomp_bits;
00328     unsigned int ucomp_bits;
00330     unsigned int vcomp_bits;
00332     unsigned int frame_bits;
00333 } dirac_enc_framestats_t;
00334 
00336 typedef struct
00337 {
00339     unsigned int mv_bits;
00341     unsigned int seq_bits;
00343     unsigned int ycomp_bits;
00345     unsigned int ucomp_bits;
00347     unsigned int vcomp_bits;
00349     unsigned int bit_rate;
00350 } dirac_enc_seqstats_t;
00351 
00353 typedef struct
00354 {
00356     int x;
00358     int y;
00359 } dirac_mv_t;
00360 
00362 typedef struct
00363 {
00365     float SAD;
00367     float mvcost;
00368 } dirac_mv_cost_t;
00369 
00371 typedef struct
00372 {
00374     dirac_frame_type_t ftype;
00376     dirac_reference_type_t rtype;
00378     int fnum;
00380     int num_refs;
00382     int refs[2];
00384     int xbsep;
00386     int ybsep;
00388     int mb_xlen;
00390     int mb_ylen;
00392     int mv_xlen;
00394     int mv_ylen;
00396     int *mb_split_mode;
00398     float *mb_costs;
00400     int *pred_mode;
00402     float *intra_costs;
00404     dirac_mv_cost_t *bipred_costs;
00406     short *dc_ycomp;
00408     short *dc_ucomp;
00410     short *dc_vcomp;
00412     dirac_mv_t *mv[2];
00414     dirac_mv_cost_t *pred_costs[2];
00415 } dirac_instr_t;
00416 
00418 typedef struct
00419 {
00421     dirac_encoder_context_t enc_ctx;
00422 
00424     int encoded_frame_avail;
00425 
00430     dirac_enc_data_t enc_buf;
00431 
00433     dirac_frameparams_t enc_fparams;
00434 
00436     dirac_enc_framestats_t enc_fstats;
00437 
00439     dirac_enc_seqstats_t enc_seqstats;
00440 
00442     int end_of_sequence;
00443 
00444     /* locally decoded frame available flag. 
00445        1 - locally decoded frame available in dec_buf. 
00446        0 - locally decoded frame not available.
00447     */
00448     int decoded_frame_avail;
00449 
00454     dirac_framebuf_t dec_buf;
00455 
00457     dirac_frameparams_t dec_fparams;
00458 
00462     dirac_instr_t instr;
00463 
00468     int instr_data_avail;
00469 
00471     const void *compressor;
00472 } dirac_encoder_t;
00473 
00480 extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose);
00481 
00491 extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size);
00492 
00502 extern DllExport dirac_encoder_state_t dirac_encoder_output (dirac_encoder_t *encoder);
00503 
00511 extern DllExport int dirac_encoder_end_sequence (dirac_encoder_t *encoder);
00512 
00517 extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder);
00518 
00519 #endif
00520 #ifdef __cplusplus
00521 }
00522 #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.