# 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.28 2008/11/18 23:25:54 asuraparaju Exp $ $Name: Dirac_1_0_2 $
    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 combined_me;
    00187     int x_range_me;
    00189     int y_range_me;
    00191     int L1_sep;
    00195     int num_L1;
    00197     float cpd;
    00199     int xblen;
    00201     int yblen;
    00203     int xbsep;
    00205     int ybsep;
    00207     int video_format;
    00209     dirac_wlt_filter_t intra_wlt_filter;
    00211     dirac_wlt_filter_t inter_wlt_filter;
    00213     unsigned int wlt_depth;
    00215     unsigned int spatial_partition;
    00217     dirac_prefilter_t prefilter;
    00219     unsigned int prefilter_strength;
    00221     unsigned int multi_quants;
    00223     dirac_mvprecision_t mv_precision;
    00225     int trate;
    00227     unsigned int picture_coding_mode;
    00229     int using_ac;
    00230 } dirac_encparams_t;
    00231
    00233 typedef struct
    00234 {
    00236     dirac_sourceparams_t src_params;
    00238     dirac_encparams_t enc_params;
    00240     int instr_flag;
    00243     int decode_flag;
    00244 } dirac_encoder_context_t;
    00245
    00258 extern DllExport void dirac_encoder_context_init (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset);
    00259
    00260
    00262 typedef struct
    00263 {
    00265     unsigned char *buffer;
    00267     int size;
    00268 } dirac_enc_data_t;
    00269
    00271 typedef struct
    00272 {
    00274     unsigned int mv_bits;
    00276     unsigned int ycomp_bits;
    00278     unsigned int ucomp_bits;
    00280     unsigned int vcomp_bits;
    00282     unsigned int pic_bits;
    00283 } dirac_enc_picstats_t;
    00284
    00286 typedef struct
    00287 {
    00289     int64_t mv_bits;
    00291     int64_t seq_bits;
    00293     int64_t ycomp_bits;
    00295     int64_t ucomp_bits;
    00297     int64_t vcomp_bits;
    00299     int64_t bit_rate;
    00300 } dirac_enc_seqstats_t;
    00301
    00303 typedef struct
    00304 {
    00306     int x;
    00308     int y;
    00309 } dirac_mv_t;
    00310
    00312 typedef struct
    00313 {
    00315     float SAD;
    00317     float mvcost;
    00318 } dirac_mv_cost_t;
    00319
    00321 typedef struct
    00322 {
    00324     dirac_picture_type_t ptype;
    00326     dirac_reference_type_t rtype;
    00328     int pnum;
    00330     int num_refs;
    00332     int refs[2];
    00334     int xbsep;
    00336     int ybsep;
    00338     int sb_xlen;
    00340     int sb_ylen;
    00342     int mv_xlen;
    00344     int mv_ylen;
    00346     int *sb_split_mode;
    00348     float *sb_costs;
    00350     int *pred_mode;
    00352     float *intra_costs;
    00354     dirac_mv_cost_t *bipred_costs;
    00356     short *dc_ycomp;
    00358     short *dc_ucomp;
    00360     short *dc_vcomp;
    00362     dirac_mv_t *mv[2];
    00364     dirac_mv_cost_t *pred_costs[2];
    00365 } dirac_instr_t;
    00366
    00368 typedef struct
    00369 {
    00371     dirac_encoder_context_t enc_ctx;
    00372
    00374     int encoded_picture_avail;
    00375
    00380     dirac_enc_data_t enc_buf;
    00381
    00383     dirac_picparams_t enc_pparams;
    00384
    00386     dirac_enc_picstats_t enc_pstats;
    00387
    00389     dirac_enc_seqstats_t enc_seqstats;
    00390
    00392     int end_of_sequence;
    00393
    00394     /* locally decoded frame (NB: not picture) available flag.
    00395        1 - locally decoded frame available in dec_buf.
    00396        0 - locally decoded frame not available.
    00397     */
    00398     int decoded_frame_avail;
    00399
    00404     dirac_framebuf_t dec_buf;
    00405
    00407     dirac_picparams_t dec_pparams;
    00408
    00412     dirac_instr_t instr;
    00413
    00418     int instr_data_avail;
    00419
    00421     const void *compressor;
    00422 } dirac_encoder_t;
    00423
    00430 extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose);
    00431
    00432 #if DIRAC_RESEARCH_VERSION_ATLEAST(1,0,2)
    00433
    00440 extern DllExport int dirac_encoder_pts_offset (const dirac_encoder_t *encoder);
    00441 #endif
    00442
    00452 extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size);
    00453
    00464 extern DllExport dirac_encoder_state_t dirac_encoder_output (dirac_encoder_t *encoder);
    00465
    00470 extern DllExport void dirac_encoder_end_sequence (dirac_encoder_t *encoder);
    00471
    00476 extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder);
    00477
    00478 #endif
    00479 #ifdef __cplusplus
    00480 }
    00481 #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.