libtheora
1.1.1
|
00001 /******************************************************************** 00002 * * 00003 * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. * 00004 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 00005 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 00006 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 00007 * * 00008 * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 * 00009 * by the Xiph.Org Foundation http://www.xiph.org/ * 00010 * * 00011 ******************************************************************** 00012 00013 function: 00014 last mod: $Id: theora.h,v 1.8 2004/03/15 22:17:32 derf Exp $ 00015 00016 ********************************************************************/ 00017 00062 #if !defined(_O_THEORA_CODEC_H_) 00063 # define _O_THEORA_CODEC_H_ (1) 00064 # include <ogg/ogg.h> 00065 00066 #if defined(__cplusplus) 00067 extern "C" { 00068 #endif 00069 00070 00071 00075 #define TH_EFAULT (-1) 00076 00077 #define TH_EINVAL (-10) 00078 00079 #define TH_EBADHEADER (-20) 00080 00081 #define TH_ENOTFORMAT (-21) 00082 00083 #define TH_EVERSION (-22) 00084 00085 #define TH_EIMPL (-23) 00086 00087 #define TH_EBADPACKET (-24) 00088 00091 #define TH_DUPFRAME (1) 00092 00098 typedef enum{ 00101 TH_CS_UNSPECIFIED, 00103 TH_CS_ITU_REC_470M, 00105 TH_CS_ITU_REC_470BG, 00107 TH_CS_NSPACES 00108 }th_colorspace; 00109 00114 typedef enum{ 00118 TH_PF_420, 00120 TH_PF_RSVD, 00124 TH_PF_422, 00127 TH_PF_444, 00129 TH_PF_NFORMATS 00130 }th_pixel_fmt; 00131 00132 00133 00142 typedef struct{ 00144 int width; 00146 int height; 00148 int stride; 00150 unsigned char *data; 00151 }th_img_plane; 00152 00168 typedef th_img_plane th_ycbcr_buffer[3]; 00169 00204 typedef struct{ 00208 unsigned char version_major; 00209 unsigned char version_minor; 00210 unsigned char version_subminor; 00214 ogg_uint32_t frame_width; 00217 ogg_uint32_t frame_height; 00220 ogg_uint32_t pic_width; 00223 ogg_uint32_t pic_height; 00227 ogg_uint32_t pic_x; 00235 ogg_uint32_t pic_y; 00240 ogg_uint32_t fps_numerator; 00241 ogg_uint32_t fps_denominator; 00252 ogg_uint32_t aspect_numerator; 00253 ogg_uint32_t aspect_denominator; 00256 th_colorspace colorspace; 00258 th_pixel_fmt pixel_fmt; 00262 int target_bitrate; 00268 /*Currently this is set so that a qi of 0 corresponds to distortions of 24 00269 times the JND, and each increase by 16 halves that value. 00270 This gives us fine discrimination at low qualities, yet effective rate 00271 control at high qualities. 00272 The qi value 63 is special, however. 00273 For this, the highest quality, we use one half of a JND for our threshold. 00274 Due to the lower bounds placed on allowable quantizers in Theora, we will 00275 not actually be able to achieve quality this good, but this should 00276 provide as close to visually lossless quality as Theora is capable of. 00277 We could lift the quantizer restrictions without breaking VP3.1 00278 compatibility, but this would result in quantized coefficients that are 00279 too large for the current bitstream to be able to store. 00280 We'd have to redesign the token syntax to store these large coefficients, 00281 which would make transcoding complex.*/ 00282 int quality; 00296 int keyframe_granule_shift; 00297 }th_info; 00298 00323 typedef struct th_comment{ 00325 char **user_comments; 00327 int *comment_lengths; 00329 int comments; 00332 char *vendor; 00333 }th_comment; 00334 00335 00336 00338 typedef unsigned char th_quant_base[64]; 00339 00341 typedef struct{ 00343 int nranges; 00346 const int *sizes; 00349 const th_quant_base *base_matrices; 00350 }th_quant_ranges; 00351 00409 typedef struct{ 00411 ogg_uint16_t dc_scale[64]; 00413 ogg_uint16_t ac_scale[64]; 00415 unsigned char loop_filter_limits[64]; 00417 th_quant_ranges qi_ranges[2][3]; 00418 }th_quant_info; 00419 00420 00421 00423 #define TH_NHUFFMAN_TABLES (80) 00424 00425 #define TH_NDCT_TOKENS (32) 00426 00438 typedef struct{ 00441 ogg_uint32_t pattern; 00444 int nbits; 00445 }th_huff_code; 00446 00447 00448 00456 extern const char *th_version_string(void); 00466 extern ogg_uint32_t th_version_number(void); 00476 extern ogg_int64_t th_granule_frame(void *_encdec,ogg_int64_t _granpos); 00488 extern double th_granule_time(void *_encdec,ogg_int64_t _granpos); 00498 extern int th_packet_isheader(ogg_packet *_op); 00509 extern int th_packet_iskeyframe(ogg_packet *_op); 00519 extern void th_info_init(th_info *_info); 00524 extern void th_info_clear(th_info *_info); 00525 00530 extern void th_comment_init(th_comment *_tc); 00540 extern void th_comment_add(th_comment *_tc, char *_comment); 00551 extern void th_comment_add_tag(th_comment *_tc,char *_tag,char *_val); 00567 extern char *th_comment_query(th_comment *_tc,char *_tag,int _count); 00575 extern int th_comment_query_count(th_comment *_tc,char *_tag); 00581 extern void th_comment_clear(th_comment *_tc); 00584 00585 00586 00587 #if defined(__cplusplus) 00588 } 00589 #endif 00590 00591 #endif