[xiph-commits] r11118 - in experimental/derf/theora-exp:
include/theora lib
tterribe at svn.xiph.org
tterribe at svn.xiph.org
Mon Apr 10 14:27:10 PDT 2006
Author: tterribe
Date: 2006-04-10 14:27:06 -0700 (Mon, 10 Apr 2006)
New Revision: 11118
Modified:
experimental/derf/theora-exp/include/theora/codec.h
experimental/derf/theora-exp/include/theora/theoradec.h
experimental/derf/theora-exp/lib/decinfo.c
experimental/derf/theora-exp/lib/decode.c
experimental/derf/theora-exp/lib/dequant.c
experimental/derf/theora-exp/lib/encinfo.c
experimental/derf/theora-exp/lib/encode.c
experimental/derf/theora-exp/lib/huffdec.c
experimental/derf/theora-exp/lib/state.c
Log:
- Add a return code to the decoder to indicate dropped frames.
The encoder still needs a corresponding call to encode them without wasting
undue processing time.
- Change error codes to always include an 'E' prefix, to distinguish them from
non-error return codes.
- Minor decoder comment fix.
Modified: experimental/derf/theora-exp/include/theora/codec.h
===================================================================
--- experimental/derf/theora-exp/include/theora/codec.h 2006-04-10 19:14:33 UTC (rev 11117)
+++ experimental/derf/theora-exp/include/theora/codec.h 2006-04-10 21:27:06 UTC (rev 11118)
@@ -52,22 +52,26 @@
-/**\name Error codes*/
+/**\name Return codes*/
/*@{*/
/**An invalid pointer was provided.*/
-#define TH_FAULT (-1)
+#define TH_EFAULT (-1)
/**An invalid argument was provided.*/
-#define TH_EINVAL (-10)
+#define TH_EINVAL (-10)
/**The contents of the header were incomplete, invalid, or unexpected.*/
-#define TH_BADHEADER (-20)
+#define TH_EBADHEADER (-20)
/**The header does not belong to a Theora stream.*/
-#define TH_NOTFORMAT (-21)
+#define TH_ENOTFORMAT (-21)
/**The bitstream version is too high.*/
-#define TH_VERSION (-22)
+#define TH_EVERSION (-22)
/**The specified function is not implemented.*/
-#define TH_IMPL (-23)
+#define TH_EIMPL (-23)
/**There were errors in the video data packet.*/
-#define TH_BADPACKET (-24)
+#define TH_EBADPACKET (-24)
+/**The decoded packet represented a dropped frame.
+ The player can continue to display the current frame, as the contents of the
+ decoded frame buffer have not changed.*/
+#define TH_DUPFRAME (1)
/*@}*/
/**The currently defined color space tags.
Modified: experimental/derf/theora-exp/include/theora/theoradec.h
===================================================================
--- experimental/derf/theora-exp/include/theora/theoradec.h 2006-04-10 19:14:33 UTC (rev 11117)
+++ experimental/derf/theora-exp/include/theora/theoradec.h 2006-04-10 21:27:06 UTC (rev 11118)
@@ -39,22 +39,22 @@
/**Gets the maximum post-processing level.
*
* \param[out] _buf int: The maximum post-processing level.
- * \retval TH_FAULT \a _dec_ctx or \a _buf is <tt>NULL</tt>.
- * \retval TH_EINVAL \a _buf_sz is not <tt>sizeof(int)</tt>.
- * \retval TH_IMPL Not supported by this implementation.*/
+ * \retval TH_EFAULT \a _dec_ctx or \a _buf is <tt>NULL</tt>.
+ * \retval TH_EINVAL \a _buf_sz is not <tt>sizeof(int)</tt>.
+ * \retval TH_EIMPL Not supported by this implementation.*/
#define TH_DECCTL_GET_PPLEVEL_MAX (1)
/**Sets the post-processing level.
* By default, post-processing is disabled.
*
* \param[in] _buf int: The new post-processing level.
* 0 to disable; larger values use more CPU.
- * \retval TH_FAULT \a _dec_ctx or \a _buf is <tt>NULL</tt>.
- * \retval TH_EINVAL \a _buf_sz is not <tt>sizeof(int)</tt>, or the
- * post-processing level is out of bounds.
- * The maximum post-processing level may be
- * implementation-specific, and can be obtained via
- * #TH_DECCTL_GET_PPLEVEL_MAX.
- * \retval TH_IMPL Not supported by this implementation.*/
+ * \retval TH_EFAULT \a _dec_ctx or \a _buf is <tt>NULL</tt>.
+ * \retval TH_EINVAL \a _buf_sz is not <tt>sizeof(int)</tt>, or the
+ * post-processing level is out of bounds.
+ * The maximum post-processing level may be
+ * implementation-specific, and can be obtained via
+ * #TH_DECCTL_GET_PPLEVEL_MAX.
+ * \retval TH_EIMPL Not supported by this implementation.*/
#define TH_DECCTL_SET_PPLEVEL (3)
/**Sets the granule position.
* Call this after a seek, before decoding the first frame, to ensure that the
@@ -62,9 +62,9 @@
*
* \param[in] _buf <tt>ogg_int64_t</tt>: The granule position of the next
* frame.
- * \retval TH_FAULT \a _dec_ctx or \a _buf is <tt>NULL</tt>.
- * \retval TH_EINVAL \a _buf_sz is not <tt>sizeof(ogg_int64_t)</tt>, or the
- * granule position is negative.*/
+ * \retval TH_EFAULT \a _dec_ctx or \a _buf is <tt>NULL</tt>.
+ * \retval TH_EINVAL \a _buf_sz is not <tt>sizeof(ogg_int64_t)</tt>, or the
+ * granule position is negative.*/
#define TH_DECCTL_SET_GRANPOS (5)
/**Sets the striped decode callback function.
* If set, this function will be called as each piece of a frame is fully
@@ -74,9 +74,9 @@
* callbacks at any point.
*
* \param[in] _buf #th_stripe_callback: The callback parameters.
- * \retval TH_FAULT \a _dec_ctx or \a _buf is <tt>NULL</tt>.
- * \retval TH_EINVAL \a _buf_sz is not
- * <tt>sizeof(th_stripe_callback)</tt>.*/
+ * \retval TH_EFAULT \a _dec_ctx or \a _buf is <tt>NULL</tt>.
+ * \retval TH_EINVAL \a _buf_sz is not
+ * <tt>sizeof(th_stripe_callback)</tt>.*/
#define TH_DECCTL_SET_STRIPE_CB (7)
/*@}*/
@@ -191,20 +191,20 @@
* initial packets of an Ogg logical stream.
* \return A positive value indicates that a Theora header was successfully
* processed.
- * \retval 0 The first video data packet was encountered after all
- * required header packets were parsed.
- * The packet just passed in on this call should be saved
- * and fed to th_decode_packetin() to begin decoding
- * video data.
- * \retval TH_FAULT One of \a _info, \a _tc, or \a _setup was
- * <tt>NULL</tt>.
- * \retval TH_BADHEADER \a _op was <tt>NULL</tt>, the packet was not the next
- * header packet in the expected sequence, or the format
- * of the header data was invalid.
- * \retval TH_VERSION The packet data was a Theora info header, but for a
- * bitstream version not decodable with this version of
- * <tt>libtheora</tt>.
- * \retval TH_NOTFORMAT The packet was not a Theora header.
+ * \retval 0 The first video data packet was encountered after all
+ * required header packets were parsed.
+ * The packet just passed in on this call should be saved
+ * and fed to th_decode_packetin() to begin decoding
+ * video data.
+ * \retval TH_EFAULT One of \a _info, \a _tc, or \a _setup was
+ * <tt>NULL</tt>.
+ * \retval TH_EBADHEADER \a _op was <tt>NULL</tt>, the packet was not the next
+ * header packet in the expected sequence, or the format
+ * of the header data was invalid.
+ * \retval TH_EVERSION The packet data was a Theora info header, but for a
+ * bitstream version not decodable with this version of
+ * <tt>libtheora</tt>.
+ * \retval TH_ENOTFORMAT The packet was not a Theora header.
*/
extern int th_decode_headerin(th_info *_info,th_comment *_tc,
th_setup_info **_setup,ogg_packet *_op);
@@ -242,11 +242,17 @@
* packets.
* After a seek, the correct granule position must be set via
* #TH_DECCTL_SET_GRANPOS for this to work properly.
- * \retval 0 Success.
- * \retval TH_FAULT \a _dec or _op was <tt>NULL</tt>.
- * \retval TH_BADPACKET \a _op does not contain encoded video data.
- * \retval TH_IMPL The video data uses bitstream features which this
- * library does not support.*/
+ * \retval 0 Success.
+ * A new decoded frame can be retrieved by calling
+ * th_decode_ycbcr_out().
+ * \retval TH_DUPFRAME The packet represented a dropped (0-byte) frame.
+ * The player can skip the call to th_decode_ycbcr_out(),
+ * as the contents of the decoded frame buffer have not
+ * changed.
+ * \retval TH_EFAULT \a _dec or _op was <tt>NULL</tt>.
+ * \retval TH_EBADPACKET \a _op does not contain encoded video data.
+ * \retval TH_EIMPL The video data uses bitstream features which this
+ * library does not support.*/
extern int th_decode_packetin(th_dec_ctx *_dec,const ogg_packet *_op,
ogg_int64_t *_granpos);
/**Outputs the next available frame of decoded Y'CbCr data.
Modified: experimental/derf/theora-exp/lib/decinfo.c
===================================================================
--- experimental/derf/theora-exp/lib/decinfo.c 2006-04-10 19:14:33 UTC (rev 11117)
+++ experimental/derf/theora-exp/lib/decinfo.c 2006-04-10 21:27:06 UTC (rev 11118)
@@ -39,7 +39,7 @@
(_info->version_minor>TH_VERSION_MINOR||
_info->version_minor==TH_VERSION_MINOR&&
_info->version_subminor>TH_VERSION_SUB)){
- return TH_VERSION;
+ return TH_EVERSION;
}
/*Read the encoded frame description.*/
theora_read(_opb,16,&val);
@@ -66,7 +66,7 @@
_info->pic_width+_info->pic_x>_info->frame_width||
_info->pic_height+_info->pic_y>_info->frame_height||
_info->fps_numerator<=0||_info->fps_denominator<=0){
- return TH_BADHEADER;
+ return TH_EBADHEADER;
}
theora_read(_opb,24,&val);
_info->aspect_numerator=(ogg_uint32_t)val;
@@ -82,7 +82,7 @@
_info->keyframe_granule_shift=(int)val;
theora_read(_opb,2,&val);
_info->pixel_fmt=(th_pixel_fmt)val;
- if(theora_read(_opb,3,&val)<0||val!=0)return TH_BADHEADER;
+ if(theora_read(_opb,3,&val)<0||val!=0)return TH_EBADHEADER;
return 0;
}
@@ -90,7 +90,7 @@
long len;
/*Read the vendor string.*/
len=oc_unpack_length(_opb);
- if(len<0)return TH_BADHEADER;
+ if(len<0)return TH_EBADHEADER;
_tc->vendor=_ogg_malloc((size_t)len+1);
oc_unpack_octets(_opb,_tc->vendor,len);
_tc->vendor[len]='\0';
@@ -104,14 +104,14 @@
_tc->comments*sizeof(_tc->user_comments[0]));
for(i=0;i<_tc->comments;i++){
len=oc_unpack_length(_opb);
- if(len<0)return TH_BADHEADER;
+ if(len<0)return TH_EBADHEADER;
_tc->comment_lengths[i]=len;
_tc->user_comments[i]=_ogg_malloc((size_t)len+1);
oc_unpack_octets(_opb,_tc->user_comments[i],len);
_tc->user_comments[i][len]='\0';
}
}
- return theora_read(_opb,0,&len)<0?TH_BADHEADER:0;
+ return theora_read(_opb,0,&len)<0?TH_EBADHEADER:0;
}
static int oc_setup_unpack(oggpack_buffer *_opb,th_setup_info *_setup){
@@ -143,23 +143,23 @@
}
/*Check the codec string.*/
oc_unpack_octets(_opb,buffer,6);
- if(memcmp(buffer,"theora",6)!=0)return TH_NOTFORMAT;
+ if(memcmp(buffer,"theora",6)!=0)return TH_ENOTFORMAT;
switch(packtype){
/*Codec info header.*/
case 0x80:{
/*This should be the first packet, and we should not already be
initialized.*/
- if(!_op->b_o_s||_info->frame_width>0)return TH_BADHEADER;
+ if(!_op->b_o_s||_info->frame_width>0)return TH_EBADHEADER;
ret=oc_info_unpack(_opb,_info);
if(ret<0)th_info_clear(_info);
else ret=3;
}break;
/*Comment header.*/
case 0x81:{
- if(_tc==NULL)return TH_FAULT;
+ if(_tc==NULL)return TH_EFAULT;
/*We shoud have already decoded the info header, and should not yet have
decoded the comment header.*/
- if(_info->frame_width<=0||_tc->vendor!=NULL)return TH_BADHEADER;
+ if(_info->frame_width<=0||_tc->vendor!=NULL)return TH_EBADHEADER;
ret=oc_comment_unpack(_opb,_tc);
if(ret<0)th_comment_clear(_tc);
else ret=2;
@@ -167,11 +167,11 @@
/*Codec setup header.*/
case 0x82:{
oc_setup_info *setup;
- if(_tc==NULL||_setup==NULL)return TH_FAULT;
+ if(_tc==NULL||_setup==NULL)return TH_EFAULT;
/*We should have already decoded the info header and the comment header,
and should not yet have decoded the setup header.*/
if(_info->frame_width<=0||_tc->vendor==NULL||*_setup!=NULL){
- return TH_BADHEADER;
+ return TH_EBADHEADER;
}
setup=(oc_setup_info *)_ogg_calloc(1,sizeof(*setup));
ret=oc_setup_unpack(_opb,setup);
@@ -186,7 +186,7 @@
}break;
default:{
/*We don't know what this header is.*/
- return TH_BADHEADER;
+ return TH_EBADHEADER;
}break;
}
return ret;
@@ -200,8 +200,8 @@
th_setup_info **_setup,ogg_packet *_op){
oggpack_buffer opb;
int ret;
- if(_op==NULL)return TH_BADHEADER;
- if(_info==NULL)return TH_FAULT;
+ if(_op==NULL)return TH_EBADHEADER;
+ if(_info==NULL)return TH_EFAULT;
oggpackB_readinit(&opb,_op->packet,_op->bytes);
ret=oc_dec_headerin(&opb,_info,_tc,_setup,_op);
/*TODO: Clear opb in libogg2.*/
Modified: experimental/derf/theora-exp/lib/decode.c
===================================================================
--- experimental/derf/theora-exp/lib/decode.c 2006-04-10 19:14:33 UTC (rev 11117)
+++ experimental/derf/theora-exp/lib/decode.c 2006-04-10 21:27:06 UTC (rev 11118)
@@ -261,7 +261,7 @@
long val;
/*Check to make sure this is a data packet.*/
theora_read1(&_dec->opb,&val);
- if(val!=0)return TH_BADPACKET;
+ if(val!=0)return TH_EBADPACKET;
/*Read in the frame type (I or P).*/
theora_read1(&_dec->opb,&val);
_dec->state.frame_type=(int)val;
@@ -286,7 +286,7 @@
Most of the other unused bits in the VP3 headers were eliminated.
I don't know why these remain.*/
theora_read(&_dec->opb,3,&val);
- if(val!=0)return TH_IMPL;
+ if(val!=0)return TH_EIMPL;
}
return 0;
}
@@ -1872,14 +1872,14 @@
size_t _buf_sz){
switch(_req){
case TH_DECCTL_GET_PPLEVEL_MAX:{
- if(_dec==NULL||_buf==NULL)return TH_FAULT;
+ if(_dec==NULL||_buf==NULL)return TH_EFAULT;
if(_buf_sz!=sizeof(int))return TH_EINVAL;
(*(int *)_buf)=OC_PP_LEVEL_MAX;
return 0;
}break;
case TH_DECCTL_SET_PPLEVEL:{
int pp_level;
- if(_dec==NULL||_buf==NULL)return TH_FAULT;
+ if(_dec==NULL||_buf==NULL)return TH_EFAULT;
if(_buf_sz!=sizeof(int))return TH_EINVAL;
pp_level=*(int *)_buf;
if(pp_level<0||pp_level>OC_PP_LEVEL_MAX)return TH_EINVAL;
@@ -1888,7 +1888,7 @@
}break;
case TH_DECCTL_SET_GRANPOS:{
ogg_int64_t granpos;
- if(_dec==NULL||_buf==NULL)return TH_FAULT;
+ if(_dec==NULL||_buf==NULL)return TH_EFAULT;
if(_buf_sz!=sizeof(ogg_int64_t))return TH_EINVAL;
granpos=*(ogg_int64_t *)_buf;
if(granpos<0)return TH_EINVAL;
@@ -1901,21 +1901,21 @@
}break;
case TH_DECCTL_SET_STRIPE_CB:{
th_stripe_callback *cb;
- if(_dec==NULL||_buf==NULL)return TH_FAULT;
+ if(_dec==NULL||_buf==NULL)return TH_EFAULT;
if(_buf_sz!=sizeof(th_stripe_callback))return TH_EINVAL;
cb=(th_stripe_callback *)_buf;
_dec->stripe_cb.ctx=cb->ctx;
_dec->stripe_cb.stripe_decoded=cb->stripe_decoded;
return 0;
}break;
- default:return TH_IMPL;
+ default:return TH_EIMPL;
}
}
int th_decode_packetin(th_dec_ctx *_dec,const ogg_packet *_op,
ogg_int64_t *_granpos){
int ret;
- if(_dec==NULL||_op==NULL)return TH_FAULT;
+ if(_dec==NULL||_op==NULL)return TH_EFAULT;
/*A completely empty packet indicates a dropped frame and is treated exactly
like an inter frame with no coded blocks.
Only proceed if we have a non-empty packet.*/
@@ -1983,8 +1983,8 @@
if(_granpos!=NULL)*_granpos=_dec->state.granpos;
/*All of the rest of the operations -- DC prediction reversal,
reconstructing coded fragments, copying uncoded fragments, loop
- filtering, extending borders, and out-of-loop and post-processing --
- should be pipelined.
+ filtering, extending borders, and out-of-loop post-processing -- should
+ be pipelined.
I.e., DC prediction reversal, reconstruction, and uncoded fragment
copying are done for one or two super block rows, then loop filtering is
run as far as it can, then bordering copying, then post-processing.
@@ -2096,6 +2096,11 @@
_dec->state.ref_frame_idx[OC_FRAME_PREV]=
_dec->state.ref_frame_idx[OC_FRAME_SELF];
}
+#if defined(OC_DUMP_IMAGES)
+ /*Don't dump images for dropped frames.*/
+ oc_state_dump_frame(&_dec->state,OC_FRAME_SELF,"dec");
+#endif
+ return 0;
}
else{
/*Just update the granule position and return.*/
@@ -2104,11 +2109,8 @@
(_dec->state.curframe_num-_dec->state.keyframe_num);
_dec->state.curframe_num++;
if(_granpos!=NULL)*_granpos=_dec->state.granpos;
+ return TH_DUPFRAME;
}
-#if defined(OC_DUMP_IMAGES)
- oc_state_dump_frame(&_dec->state,OC_FRAME_SELF,"dec");
-#endif
- return 0;
}
int th_decode_ycbcr_out(th_dec_ctx *_dec,th_ycbcr_buffer _ycbcr){
Modified: experimental/derf/theora-exp/lib/dequant.c
===================================================================
--- experimental/derf/theora-exp/lib/dequant.c 2006-04-10 19:14:33 UTC (rev 11117)
+++ experimental/derf/theora-exp/lib/dequant.c 2006-04-10 21:27:06 UTC (rev 11118)
@@ -93,7 +93,7 @@
constructed qinfo.*/
if(qi>63){
_ogg_free(base_mats);
- return TH_BADHEADER;
+ return TH_EBADHEADER;
}
qranges->nranges=qri;
qranges->sizes=qrsizes=(int *)_ogg_malloc(qri*sizeof(qrsizes[0]));
Modified: experimental/derf/theora-exp/lib/encinfo.c
===================================================================
--- experimental/derf/theora-exp/lib/encinfo.c 2006-04-10 19:14:33 UTC (rev 11117)
+++ experimental/derf/theora-exp/lib/encinfo.c 2006-04-10 21:27:06 UTC (rev 11118)
@@ -17,7 +17,7 @@
int th_encode_flushheader(th_enc_ctx *_enc,th_comment *_tc,
ogg_packet *_op){
- if(_enc==NULL||_op==NULL)return TH_FAULT;
+ if(_enc==NULL||_op==NULL)return TH_EFAULT;
switch(_enc->packet_state){
/*Codec info header.*/
case OC_PACKET_INFO_HDR:{
@@ -56,7 +56,7 @@
const char *vendor;
int vendor_len;
int i;
- if(_tc==NULL)return TH_FAULT;
+ if(_tc==NULL)return TH_EFAULT;
vendor=th_version_string();
vendor_len=strlen(vendor);
oggpackB_reset(&_enc->opb);
Modified: experimental/derf/theora-exp/lib/encode.c
===================================================================
--- experimental/derf/theora-exp/lib/encode.c 2006-04-10 19:14:33 UTC (rev 11117)
+++ experimental/derf/theora-exp/lib/encode.c 2006-04-10 21:27:06 UTC (rev 11118)
@@ -287,13 +287,13 @@
This may be NULL, in which case the default Huffman codes will be
used.
Return: 0 on success, or a negative value on error.
- TH_FAULT if _enc is NULL
+ TH_EFAULT if _enc is NULL
TH_EINVAL if the setup header has already been written, the code is
not prefix free, or does not form a full binary tree.*/
static int oc_enc_set_huffman_codes(oc_enc_ctx *_enc,
const th_huff_code _codes[TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS]){
int ret;
- if(_enc==NULL)return TH_FAULT;
+ if(_enc==NULL)return TH_EFAULT;
if(_enc->packet_state>OC_PACKET_SETUP_HDR)return TH_EINVAL;
if(_codes==NULL)_codes=TH_VP31_HUFF_CODES;
/*Validate the codes.*/
@@ -312,7 +312,7 @@
This can be NULL, in which case the default quantization parameters
will be used.*
Return: 0 on success, or a negative value on error.
- TH_FAULT if _enc is NULL.
+ TH_EFAULT if _enc is NULL.
TH_EINVAL if the setup header has already been written, or it cannot
be verified that the quantization level of for a particular qti,
pli, and ci never increases as qi increases.*/
@@ -323,7 +323,7 @@
int qri;
int qi;
int ci;
- if(_enc==NULL)return TH_FAULT;
+ if(_enc==NULL)return TH_EFAULT;
if(_enc->packet_state>OC_PACKET_SETUP_HDR)return TH_EINVAL;
if(_qinfo==NULL)_qinfo=OC_DEF_QUANT_INFO+_enc->state.info.pixel_fmt;
/*Verify that, for a given qti, pli and ci, the actual quantizer will never
@@ -1363,7 +1363,7 @@
}break;
case TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE:{
ogg_uint32_t keyframe_frequency_force;
- if(_enc==NULL||_buf==NULL)return TH_FAULT;
+ if(_enc==NULL||_buf==NULL)return TH_EFAULT;
if(_buf_sz!=sizeof(ogg_uint32_t))return TH_EINVAL;
keyframe_frequency_force=*(ogg_uint32_t *)_buf;
if(_enc->packet_state==OC_PACKET_INFO_HDR){
@@ -1380,7 +1380,7 @@
case TH_ENCCTL_SET_VP3_COMPATIBLE:{
int vp3_compatible;
int ret;
- if(_enc==NULL||_buf==NULL)return TH_FAULT;
+ if(_enc==NULL||_buf==NULL)return TH_EFAULT;
if(_buf_sz!=sizeof(int))return TH_EINVAL;
vp3_compatible=*(int *)_buf;
_enc->vp3_compatible=vp3_compatible;
@@ -1405,7 +1405,7 @@
return 0;
}break;
case TH_ENCCTL_GET_SPLEVEL_MAX:{
- if(_enc==NULL||_buf==NULL)return TH_FAULT;
+ if(_enc==NULL||_buf==NULL)return TH_EFAULT;
if(_buf_sz!=sizeof(int))return TH_EINVAL;
/*We can only manipulate speed in the context of a given encoding mode.
Ensure one is selected if the user has not already done so.*/
@@ -1415,7 +1415,7 @@
}break;
case TH_ENCCTL_SET_SPLEVEL:{
int speed;
- if(_enc==NULL||_buf==NULL)return TH_FAULT;
+ if(_enc==NULL||_buf==NULL)return TH_EFAULT;
if(_buf_sz!=sizeof(int))return TH_EINVAL;
speed=*(int *)_buf;
/*We can only manipulate speed in the context of a given encoding mode.
@@ -1426,14 +1426,14 @@
return 0;
}break;
case TH_ENCCTL_SETUP_VBR:{
- if(_enc==NULL)return TH_FAULT;
+ if(_enc==NULL)return TH_EFAULT;
if(_buf==NULL&&_buf_sz!=0||_buf!=NULL&&_buf_sz!=sizeof(th_vbr_cfg)){
return TH_EINVAL;
}
if(_enc->vbr==NULL)_enc->vbr=oc_enc_vbr_alloc(_enc);
return oc_enc_vbr_enable(_enc->vbr,(th_vbr_cfg *)_buf);
}break;
- default:return TH_IMPL;
+ default:return TH_EIMPL;
}
}
@@ -1446,7 +1446,7 @@
int rfi;
int pli;
/*Step 1: validate parameters.*/
- if(_enc==NULL||_img==NULL)return TH_FAULT;
+ if(_enc==NULL||_img==NULL)return TH_EFAULT;
if(_enc->packet_state==OC_PACKET_DONE)return TH_EINVAL;
if(_img[0].width!=(int)_enc->state.info.frame_width||
_img[0].height!=(int)_enc->state.info.frame_height){
@@ -1515,7 +1515,7 @@
}
int th_encode_packetout(th_enc_ctx *_enc,int _last,ogg_packet *_op){
- if(_enc==NULL||_op==NULL)return TH_FAULT;
+ if(_enc==NULL||_op==NULL)return TH_EFAULT;
if(_enc->packet_state!=OC_PACKET_READY)return 0;
_op->packet=oggpackB_get_buffer(&_enc->opb);
_op->bytes=oggpackB_bytes(&_enc->opb);
Modified: experimental/derf/theora-exp/lib/huffdec.c
===================================================================
--- experimental/derf/theora-exp/lib/huffdec.c 2006-04-10 19:14:33 UTC (rev 11117)
+++ experimental/derf/theora-exp/lib/huffdec.c 2006-04-10 21:27:06 UTC (rev 11118)
@@ -78,8 +78,8 @@
oc_huff_node *binode;
long bits;
/*Prevent infinite recursion.*/
- if(++_depth>32)return TH_BADHEADER;
- if(theora_read1(_opb,&bits)<0)return TH_BADHEADER;
+ if(++_depth>32)return TH_EBADHEADER;
+ if(theora_read1(_opb,&bits)<0)return TH_EBADHEADER;
/*Read an internal node:*/
if(!bits){
int ret;
@@ -94,7 +94,7 @@
}
/*Read a leaf node:*/
else{
- if(theora_read(_opb,OC_NDCT_TOKEN_BITS,&bits)<0)return TH_BADHEADER;
+ if(theora_read(_opb,OC_NDCT_TOKEN_BITS,&bits)<0)return TH_EBADHEADER;
binode=oc_huff_node_alloc(0);
binode->depth=(unsigned char)(_depth>1);
binode->token=(unsigned char)bits;
Modified: experimental/derf/theora-exp/lib/state.c
===================================================================
--- experimental/derf/theora-exp/lib/state.c 2006-04-10 19:14:33 UTC (rev 11117)
+++ experimental/derf/theora-exp/lib/state.c 2006-04-10 21:27:06 UTC (rev 11118)
@@ -528,7 +528,7 @@
int oc_state_init(oc_theora_state *_state,const th_info *_info){
/*First validate the parameters.*/
- if(_info==NULL)return TH_FAULT;
+ if(_info==NULL)return TH_EFAULT;
/*The width and height of the encoded frame must be multiples of 16.
They must also, when divided by 16, fit into a 16-bit unsigned integer.
The displayable frame offset coordinates must fit into an 8-bit unsigned
@@ -1067,26 +1067,26 @@
pframe=_state->granpos-(iframe<<_state->info.keyframe_granule_shift);
sprintf(fname,"%08i%s.png",(int)(iframe+pframe),_suf);
fp=fopen(fname,"wb");
- if(fp==NULL)return TH_FAULT;
+ if(fp==NULL)return TH_EFAULT;
image=(png_bytep *)oc_malloc_2d(height,6*width,sizeof(image[0][0]));
png=png_create_write_struct(PNG_LIBPNG_VER_STRING,NULL,NULL,NULL);
if(png==NULL){
oc_free_2d(image);
fclose(fp);
- return TH_FAULT;
+ return TH_EFAULT;
}
info=png_create_info_struct(png);
if(info==NULL){
png_destroy_write_struct(&png,NULL);
oc_free_2d(image);
fclose(fp);
- return TH_FAULT;
+ return TH_EFAULT;
}
if(setjmp(png_jmpbuf(png))){
png_destroy_write_struct(&png,&info);
oc_free_2d(image);
fclose(fp);
- return TH_FAULT;
+ return TH_EFAULT;
}
framei=_state->ref_frame_idx[_frame];
y_row=_state->ref_frame_bufs[framei][0].data;
More information about the commits
mailing list