# 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.12 2007/03/21 11:05:43 tjdwave Exp $ $Name: Dirac_0_7_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 L1_sep;
    00176     int num_L1;
    00178     float cpd;
    00180     int xblen;
    00182     int yblen;
    00184     int xbsep;
    00186     int ybsep;
    00188     int video_format;
    00190     dirac_wlt_filter_t intra_wlt_filter;
    00192     dirac_wlt_filter_t inter_wlt_filter;
    00194     unsigned int wlt_depth;
    00196     unsigned int spatial_partition;
    00198     unsigned int denoise;
    00200     unsigned int def_spatial_partition;
    00202     unsigned int multi_quants;
    00204     dirac_mvprecision_t mv_precision;
    00206     int trate;
    00207 } dirac_encparams_t;
    00208
    00210 typedef struct
    00211 {
    00213     dirac_seqparams_t seq_params;
    00215     dirac_sourceparams_t src_params;
    00217     dirac_encparams_t enc_params;
    00219     int instr_flag;
    00222     int decode_flag;
    00223 } dirac_encoder_context_t;
    00224
    00311 extern DllExport void dirac_encoder_context_init (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset);
    00312
    00313
    00315 typedef struct
    00316 {
    00318     unsigned char *buffer;
    00320     int size;
    00321 } dirac_enc_data_t;
    00322
    00324 typedef struct
    00325 {
    00327     unsigned int mv_bits;
    00329     unsigned int ycomp_bits;
    00331     unsigned int ucomp_bits;
    00333     unsigned int vcomp_bits;
    00335     unsigned int frame_bits;
    00336 } dirac_enc_framestats_t;
    00337
    00339 typedef struct
    00340 {
    00342     unsigned int mv_bits;
    00344     unsigned int seq_bits;
    00346     unsigned int ycomp_bits;
    00348     unsigned int ucomp_bits;
    00350     unsigned int vcomp_bits;
    00352     unsigned int bit_rate;
    00353 } dirac_enc_seqstats_t;
    00354
    00356 typedef struct
    00357 {
    00359     int x;
    00361     int y;
    00362 } dirac_mv_t;
    00363
    00365 typedef struct
    00366 {
    00368     float SAD;
    00370     float mvcost;
    00371 } dirac_mv_cost_t;
    00372
    00374 typedef struct
    00375 {
    00377     dirac_frame_type_t ftype;
    00379     dirac_reference_type_t rtype;
    00381     int fnum;
    00383     int num_refs;
    00385     int refs[2];
    00387     int xbsep;
    00389     int ybsep;
    00391     int mb_xlen;
    00393     int mb_ylen;
    00395     int mv_xlen;
    00397     int mv_ylen;
    00399     int *mb_split_mode;
    00401     float *mb_costs;
    00403     int *pred_mode;
    00405     float *intra_costs;
    00407     dirac_mv_cost_t *bipred_costs;
    00409     short *dc_ycomp;
    00411     short *dc_ucomp;
    00413     short *dc_vcomp;
    00415     dirac_mv_t *mv[2];
    00417     dirac_mv_cost_t *pred_costs[2];
    00418 } dirac_instr_t;
    00419
    00421 typedef struct
    00422 {
    00424     dirac_encoder_context_t enc_ctx;
    00425
    00427     int encoded_frame_avail;
    00428
    00433     dirac_enc_data_t enc_buf;
    00434
    00436     dirac_frameparams_t enc_fparams;
    00437
    00439     dirac_enc_framestats_t enc_fstats;
    00440
    00442     dirac_enc_seqstats_t enc_seqstats;
    00443
    00445     int end_of_sequence;
    00446
    00447     /* locally decoded frame available flag.
    00448        1 - locally decoded frame available in dec_buf.
    00449        0 - locally decoded frame not available.
    00450     */
    00451     int decoded_frame_avail;
    00452
    00457     dirac_framebuf_t dec_buf;
    00458
    00460     dirac_frameparams_t dec_fparams;
    00461
    00465     dirac_instr_t instr;
    00466
    00471     int instr_data_avail;
    00472
    00474     const void *compressor;
    00475 } dirac_encoder_t;
    00476
    00483 extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose);
    00484
    00494 extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size);
    00495
    00505 extern DllExport dirac_encoder_state_t dirac_encoder_output (dirac_encoder_t *encoder);
    00506
    00514 extern DllExport int dirac_encoder_end_sequence (dirac_encoder_t *encoder);
    00515
    00520 extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder);
    00521
    00522 #endif
    00523 #ifdef __cplusplus
    00524 }
    00525 #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.