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.26 2008/05/21 03:57:50 asuraparaju Exp $ $Name: Dirac_1_0_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_inttypes.h>
00045 #include <libdirac_common/dirac_types.h>
00046 
00151 #ifdef __cplusplus
00152 extern "C" {
00153 #endif
00154 
00156 typedef enum
00157 { 
00158     ENC_STATE_INVALID = -1, 
00159     ENC_STATE_BUFFER, 
00160     ENC_STATE_AVAIL,
00161     ENC_STATE_EOS
00162 } dirac_encoder_state_t ;
00163 
00166 typedef PrefilterType dirac_prefilter_t;
00167 
00170 typedef VideoFormat dirac_encoder_presets_t;
00171 
00174 typedef MVPrecisionType dirac_mvprecision_t;
00176 typedef struct 
00177 {
00179     int lossless;
00181     float qf;
00183     int full_search;
00185     int x_range_me;
00187     int y_range_me;
00189     int L1_sep;
00193     int num_L1;
00195     float cpd;
00197     int xblen;
00199     int yblen;
00201     int xbsep;
00203     int ybsep;
00205     int video_format;
00207     dirac_wlt_filter_t intra_wlt_filter;
00209     dirac_wlt_filter_t inter_wlt_filter;
00211     unsigned int wlt_depth;
00213     unsigned int spatial_partition;
00215     dirac_prefilter_t prefilter;
00217     unsigned int prefilter_strength;
00219     unsigned int multi_quants;
00221     dirac_mvprecision_t mv_precision;
00223     int trate;
00225     unsigned int picture_coding_mode;
00227     int using_ac;
00228 } dirac_encparams_t;
00229 
00231 typedef struct
00232 {
00234     dirac_sourceparams_t src_params;
00236     dirac_encparams_t enc_params;
00238     int instr_flag;
00241     int decode_flag;
00242 } dirac_encoder_context_t;
00243 
00256 extern DllExport void dirac_encoder_context_init (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset);
00257 
00258 
00260 typedef struct
00261 {
00263     unsigned char *buffer;
00265     int size;
00266 } dirac_enc_data_t;
00267 
00269 typedef struct
00270 {
00272     unsigned int mv_bits;
00274     unsigned int ycomp_bits;
00276     unsigned int ucomp_bits;
00278     unsigned int vcomp_bits;
00280     unsigned int pic_bits;
00281 } dirac_enc_picstats_t;
00282 
00284 typedef struct
00285 {
00287     int64_t mv_bits;
00289     int64_t seq_bits;
00291     int64_t ycomp_bits;
00293     int64_t ucomp_bits;
00295     int64_t vcomp_bits;
00297     int64_t bit_rate;
00298 } dirac_enc_seqstats_t;
00299 
00301 typedef struct
00302 {
00304     int x;
00306     int y;
00307 } dirac_mv_t;
00308 
00310 typedef struct
00311 {
00313     float SAD;
00315     float mvcost;
00316 } dirac_mv_cost_t;
00317 
00319 typedef struct
00320 {
00322     dirac_picture_type_t ptype;
00324     dirac_reference_type_t rtype;
00326     int pnum;
00328     int num_refs;
00330     int refs[2];
00332     int xbsep;
00334     int ybsep;
00336     int mb_xlen;
00338     int mb_ylen;
00340     int mv_xlen;
00342     int mv_ylen;
00344     int *mb_split_mode;
00346     float *mb_costs;
00348     int *pred_mode;
00350     float *intra_costs;
00352     dirac_mv_cost_t *bipred_costs;
00354     short *dc_ycomp;
00356     short *dc_ucomp;
00358     short *dc_vcomp;
00360     dirac_mv_t *mv[2];
00362     dirac_mv_cost_t *pred_costs[2];
00363 } dirac_instr_t;
00364 
00366 typedef struct
00367 {
00369     dirac_encoder_context_t enc_ctx;
00370 
00372     int encoded_picture_avail;
00373 
00378     dirac_enc_data_t enc_buf;
00379 
00381     dirac_picparams_t enc_pparams;
00382 
00384     dirac_enc_picstats_t enc_pstats;
00385 
00387     dirac_enc_seqstats_t enc_seqstats;
00388 
00390     int end_of_sequence;
00391 
00392     /* locally decoded frame (NB: not picture) available flag. 
00393        1 - locally decoded frame available in dec_buf. 
00394        0 - locally decoded frame not available.
00395     */
00396     int decoded_frame_avail;
00397 
00402     dirac_framebuf_t dec_buf;
00403 
00405     dirac_picparams_t dec_pparams;
00406 
00410     dirac_instr_t instr;
00411 
00416     int instr_data_avail;
00417 
00419     const void *compressor;
00420 } dirac_encoder_t;
00421 
00428 extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose);
00429 
00439 extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size);
00440 
00451 extern DllExport dirac_encoder_state_t dirac_encoder_output (dirac_encoder_t *encoder);
00452 
00457 extern DllExport void dirac_encoder_end_sequence (dirac_encoder_t *encoder);
00458 
00463 extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder);
00464 
00465 #endif
00466 #ifdef __cplusplus
00467 }
00468 #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.