# 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.8 2006/05/16 11:23:44 asuraparaju Exp $ $Name: Dirac_0_6_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 *
    00026 * Alternatively, the contents of this file may be used under the terms of
    00027 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
    00028 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
    00029 * the GPL or the LGPL are applicable instead of those above. If you wish to
    00030 * allow use of your version of this file only under the terms of the either
    00031 * the GPL or LGPL and not to allow others to use your version of this file
    00032 * under the MPL, indicate your decision by deleting the provisions above
    00033 * and replace them with the notice and other provisions required by the GPL
    00034 * or LGPL. If you do not delete the provisions above, a recipient may use
    00035 * your version of this file under the terms of any one of the MPL, the GPL
    00036 * or the LGPL.
    00037 * ***** END LICENSE BLOCK ***** */
    00038
    00039 #ifndef DIRAC_ENCODER_H
    00040 #define DIRAC_ENCODER_H
    00041
    00042 #include <libdirac_common/dirac_types.h>
    00043
    00142 #ifdef __cplusplus
    00143 extern "C" {
    00144 #endif
    00145
    00147 typedef enum
    00148 {
    00149     ENC_STATE_INVALID = -1,
    00150     ENC_STATE_BUFFER,
    00151     ENC_STATE_AVAIL
    00152 } dirac_encoder_state_t ;
    00153
    00156 typedef VideoFormat dirac_encoder_presets_t;
    00157
    00160 typedef MVPrecisionType dirac_mvprecision_t;
    00161
    00163 typedef struct
    00164 {
    00166     int lossless;
    00168     float qf;
    00170     int L1_sep;
    00174     int num_L1;
    00176     float cpd;
    00178     int xblen;
    00180     int yblen;
    00182     int xbsep;
    00184     int ybsep;
    00186     int video_format;
    00188     dirac_wlt_filter_t wlt_filter;
    00190     unsigned int wlt_depth;
    00192     unsigned int spatial_partition;
    00194     unsigned int def_spatial_partition;
    00196     unsigned int multi_quants;
    00198     dirac_mvprecision_t mv_precision;
    00199 } dirac_encparams_t;
    00200
    00202 typedef struct
    00203 {
    00205     dirac_seqparams_t seq_params;
    00207     dirac_sourceparams_t src_params;
    00209     dirac_encparams_t enc_params;
    00211     int instr_flag;
    00214     int decode_flag;
    00215 } dirac_encoder_context_t;
    00216
    00303 extern DllExport void dirac_encoder_context_init (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset);
    00304
    00305
    00307 typedef struct
    00308 {
    00310     unsigned char *buffer;
    00312     int size;
    00313 } dirac_enc_data_t;
    00314
    00316 typedef struct
    00317 {
    00319     unsigned int mv_bits;
    00321     unsigned int ycomp_bits;
    00323     unsigned int ucomp_bits;
    00325     unsigned int vcomp_bits;
    00327     unsigned int frame_bits;
    00328 } dirac_enc_framestats_t;
    00329
    00331 typedef struct
    00332 {
    00334     unsigned int mv_bits;
    00336     unsigned int seq_bits;
    00338     unsigned int ycomp_bits;
    00340     unsigned int ucomp_bits;
    00342     unsigned int vcomp_bits;
    00344     unsigned int bit_rate;
    00345 } dirac_enc_seqstats_t;
    00346
    00348 typedef struct
    00349 {
    00351     int x;
    00353     int y;
    00354 } dirac_mv_t;
    00355
    00357 typedef struct
    00358 {
    00360     float SAD;
    00362     float mvcost;
    00363 } dirac_mv_cost_t;
    00364
    00366 typedef struct
    00367 {
    00369     dirac_frame_type_t ftype;
    00371     dirac_reference_type_t rtype;
    00373     int fnum;
    00375     int num_refs;
    00377     int refs[2];
    00379     int xbsep;
    00381     int ybsep;
    00383     int mb_xlen;
    00385     int mb_ylen;
    00387     int mv_xlen;
    00389     int mv_ylen;
    00391     int *mb_split_mode;
    00393     int *mb_common_mode;
    00395     float *mb_costs;
    00397     int *pred_mode;
    00399     float *intra_costs;
    00401     dirac_mv_cost_t *bipred_costs;
    00403     short *dc_ycomp;
    00405     short *dc_ucomp;
    00407     short *dc_vcomp;
    00409     dirac_mv_t *mv[2];
    00411     dirac_mv_cost_t *pred_costs[2];
    00412 } dirac_instr_t;
    00413
    00415 typedef struct
    00416 {
    00418     dirac_encoder_context_t enc_ctx;
    00419
    00421     int encoded_frame_avail;
    00422
    00427     dirac_enc_data_t enc_buf;
    00428
    00430     dirac_frameparams_t enc_fparams;
    00431
    00433     dirac_enc_framestats_t enc_fstats;
    00434
    00436     dirac_enc_seqstats_t enc_seqstats;
    00437
    00439     int end_of_sequence;
    00440
    00441     /* locally decoded frame available flag.
    00442        1 - locally decoded frame available in dec_buf.
    00443        0 - locally decoded frame not available.
    00444     */
    00445     int decoded_frame_avail;
    00446
    00451     dirac_framebuf_t dec_buf;
    00452
    00454     dirac_frameparams_t dec_fparams;
    00455
    00459     dirac_instr_t instr;
    00460
    00465     int instr_data_avail;
    00466
    00468     const void *compressor;
    00469 } dirac_encoder_t;
    00470
    00477 extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose);
    00478
    00488 extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size);
    00489
    00499 extern DllExport dirac_encoder_state_t dirac_encoder_output (dirac_encoder_t *encoder);
    00500
    00508 extern DllExport int dirac_encoder_end_sequence (dirac_encoder_t *encoder);
    00509
    00514 extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder);
    00515
    00516 #endif
    00517 #ifdef __cplusplus
    00518 }
    00519 #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.