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.5 2005/09/27 13:44:26 dirac_dev Exp $ $Name: Dirac_0_5_4 $
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 *
00025 * Alternatively, the contents of this file may be used under the terms of
00026 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
00027 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
00028 * the GPL or the LGPL are applicable instead of those above. If you wish to
00029 * allow use of your version of this file only under the terms of the either
00030 * the GPL or LGPL and not to allow others to use your version of this file
00031 * under the MPL, indicate your decision by deleting the provisions above
00032 * and replace them with the notice and other provisions required by the GPL
00033 * or LGPL. If you do not delete the provisions above, a recipient may use
00034 * your version of this file under the terms of any one of the MPL, the GPL
00035 * or the LGPL.
00036 * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef DIRAC_ENCODER_H
00039 #define DIRAC_ENCODER_H
00040 
00041 #include <libdirac_common/dirac_types.h>
00042 
00141 #ifdef __cplusplus
00142 extern "C" {
00143 #endif
00144 
00146 typedef enum
00147 { 
00148     ENC_STATE_INVALID = -1, 
00149     ENC_STATE_BUFFER, 
00150     ENC_STATE_AVAIL
00151 } dirac_encoder_state_t ;
00152 
00155 typedef enum
00156 {
00157     CIF, 
00158     SD576, 
00159     HD720, 
00160     HD1080
00161 } dirac_encoder_presets_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;
00186 } dirac_encparams_t;
00187 
00189 typedef struct
00190 {
00192     dirac_seqparams_t seq_params;
00194     dirac_encparams_t enc_params;
00196     int instr_flag;
00199     int decode_flag;
00200 } dirac_encoder_context_t;
00201 
00288 extern DllExport void dirac_encoder_context_init (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset);
00289 
00290 
00292 typedef struct
00293 {
00295     unsigned char *buffer;
00297     int size;
00298 } dirac_enc_data_t;
00299 
00301 typedef struct
00302 {
00304     unsigned int mv_bits;
00306     unsigned int mv_hdr_bits;
00308     unsigned int ycomp_bits;
00310     unsigned int ycomp_hdr_bits;
00312     unsigned int ucomp_bits;
00314     unsigned int ucomp_hdr_bits;
00316     unsigned int vcomp_bits;
00318     unsigned int vcomp_hdr_bits;
00320     unsigned int frame_bits;
00322     unsigned int frame_hdr_bits;
00323 } dirac_enc_framestats_t;
00324 
00326 typedef struct
00327 {
00329     unsigned int mv_bits;
00331     unsigned int seq_bits;
00333     unsigned int seq_hdr_bits;
00335     unsigned int ycomp_bits;
00337     unsigned int ucomp_bits;
00339     unsigned int vcomp_bits;
00341     unsigned int bit_rate;
00342 } dirac_enc_seqstats_t;
00343 
00345 typedef struct
00346 {
00348     int x;
00350     int y;
00351 } dirac_mv_t;
00352 
00354 typedef struct
00355 {
00357     float SAD;
00359     float mvcost;
00360 } dirac_mv_cost_t;
00361 
00363 typedef struct
00364 {
00366     dirac_frame_type_t ftype;
00368     int fnum;
00370     int num_refs;
00372     int refs[2];
00374     int xbsep;
00376     int ybsep;
00378     int mb_xlen;
00380     int mb_ylen;
00382     int mv_xlen;
00384     int mv_ylen;
00386     int *mb_split_mode;
00388     int *mb_common_mode;
00390     float *mb_costs;
00392     int *pred_mode;
00394     float *intra_costs;
00396     dirac_mv_cost_t *bipred_costs;
00398     short *dc_ycomp;
00400     short *dc_ucomp;
00402     short *dc_vcomp;
00404     dirac_mv_t *mv[2];
00406     dirac_mv_cost_t *pred_costs[2];
00407 } dirac_instr_t;
00408 
00410 typedef struct
00411 {
00413     dirac_encoder_context_t enc_ctx;
00414 
00416     int encoded_frame_avail;
00417 
00422     dirac_enc_data_t enc_buf;
00423 
00425     dirac_frameparams_t enc_fparams;
00426 
00428     dirac_enc_framestats_t enc_fstats;
00429 
00431     dirac_enc_seqstats_t enc_seqstats;
00432 
00434     int end_of_sequence;
00435 
00436     /* locally decoded frame available flag. 
00437        1 - locally decoded frame available in dec_buf. 
00438        0 - locally decoded frame not available.
00439     */
00440     int decoded_frame_avail;
00441 
00446     dirac_framebuf_t dec_buf;
00447 
00449     dirac_frameparams_t dec_fparams;
00450 
00454     dirac_instr_t instr;
00455 
00460     int instr_data_avail;
00461 
00463     const void *compressor;
00464 } dirac_encoder_t;
00465 
00472 extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose);
00473 
00483 extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size);
00484 
00494 extern DllExport dirac_encoder_state_t dirac_encoder_output (dirac_encoder_t *encoder);
00495 
00503 extern DllExport int dirac_encoder_end_sequence (dirac_encoder_t *encoder);
00504 
00509 extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder);
00510 
00511 #endif
00512 #ifdef __cplusplus
00513 }
00514 #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.