[xiph-commits] r9298 -
trunk/oggdsf/src/lib/codecs/theora/libs/libtheora/lib
ozone at motherfish-iii.xiph.org
ozone at motherfish-iii.xiph.org
Sun May 22 03:06:17 PDT 2005
Author: ozone
Date: 2005-05-22 03:06:13 -0700 (Sun, 22 May 2005)
New Revision: 9298
Modified:
trunk/oggdsf/src/lib/codecs/theora/libs/libtheora/lib/encoder_toplevel.c
trunk/oggdsf/src/lib/codecs/theora/libs/libtheora/lib/misc_common.c
Log:
oggdsf:
* Merge revision:9037 revision:9038 and revision:9197 into oggdsf's libtheora tree, so that Theora encoding doesn't suffer from bad-looking artifacts during still scenes
Modified: trunk/oggdsf/src/lib/codecs/theora/libs/libtheora/lib/encoder_toplevel.c
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/libs/libtheora/lib/encoder_toplevel.c 2005-05-21 21:19:27 UTC (rev 9297)
+++ trunk/oggdsf/src/lib/codecs/theora/libs/libtheora/lib/encoder_toplevel.c 2005-05-22 10:06:13 UTC (rev 9298)
@@ -739,12 +739,11 @@
/* Increment the frames since last key frame count */
cpi->LastKeyFrame++;
- if ( cpi->MotionScore > 0 ){
- cpi->DropCount = 0;
+ /* Proceed with the frame update. */
+ UpdateFrame(cpi);
+ cpi->DropCount = 0;
- /* Proceed with the frame update. */
- UpdateFrame(cpi);
-
+ if ( cpi->MotionScore > 0 ){
/* Note the Quantizer used for each block coded. */
for ( i = 0; i < cpi->pb.UnitFragments; i++ ){
if ( cpi->pb.display_fragments[i] ){
@@ -862,8 +861,8 @@
/* Set key frame data rate target; this is nominal keyframe size */
cpi->Configuration.KeyFrameDataTarget = (c->keyframe_data_target_bitrate *
- c->fps_numerator /
- c->fps_denominator ) / 8;
+ c->fps_denominator /
+ c->fps_numerator ) / 8;
/* Note the height and width in the pre-processor control structure. */
cpi->ScanConfig.VideoFrameHeight = cpi->pb.info.height;
Modified: trunk/oggdsf/src/lib/codecs/theora/libs/libtheora/lib/misc_common.c
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/libs/libtheora/lib/misc_common.c 2005-05-21 21:19:27 UTC (rev 9297)
+++ trunk/oggdsf/src/lib/codecs/theora/libs/libtheora/lib/misc_common.c 2005-05-22 10:06:13 UTC (rev 9298)
@@ -230,25 +230,27 @@
}
void RegulateQ( CP_INSTANCE *cpi, ogg_int32_t UpdateScore ) {
- double TargetUnitScoreBytes = (double)cpi->ThisFrameTargetBytes /
- (double)UpdateScore;
double PredUnitScoreBytes;
- double LastBitError = 10000.0; /* Silly high number */
ogg_uint32_t QIndex = Q_TABLE_SIZE - 1;
ogg_uint32_t i;
- /* Search for the best Q for the target bitrate. */
- for ( i = 0; i < Q_TABLE_SIZE; i++ ) {
- PredUnitScoreBytes = GetEstimatedBpb( cpi, cpi->pb.QThreshTable[i] );
- if ( PredUnitScoreBytes > TargetUnitScoreBytes ) {
- if ( (PredUnitScoreBytes - TargetUnitScoreBytes) <= LastBitError ) {
- QIndex = i;
+ if ( UpdateScore > 0 ) {
+ double TargetUnitScoreBytes = (double)cpi->ThisFrameTargetBytes /
+ (double)UpdateScore;
+ double LastBitError = 10000.0; /* Silly high number */
+ /* Search for the best Q for the target bitrate. */
+ for ( i = 0; i < Q_TABLE_SIZE; i++ ) {
+ PredUnitScoreBytes = GetEstimatedBpb( cpi, cpi->pb.QThreshTable[i] );
+ if ( PredUnitScoreBytes > TargetUnitScoreBytes ) {
+ if ( (PredUnitScoreBytes - TargetUnitScoreBytes) <= LastBitError ) {
+ QIndex = i;
+ } else {
+ QIndex = i - 1;
+ }
+ break;
} else {
- QIndex = i - 1;
+ LastBitError = TargetUnitScoreBytes - PredUnitScoreBytes;
}
- break;
- } else {
- LastBitError = TargetUnitScoreBytes - PredUnitScoreBytes;
}
}
More information about the commits
mailing list