aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-03-06 12:33:56 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-03-06 12:33:56 +0000
commite82d912dba14d6d5ee53f84544ef50b79c288925 (patch)
tree95ce91bdb141d4b267a66717f0e239496db90602
parente4053d526b6aff298e7778cc23c99c80eb3c4949 (diff)
downloadffmpeg-e82d912dba14d6d5ee53f84544ef50b79c288925.tar.gz
h263 framerate & aspect ratio fixes
Originally committed as revision 2854 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/h263.c19
-rw-r--r--tests/ffmpeg.regression.ref4
-rw-r--r--tests/rotozoom.regression.ref4
3 files changed, 19 insertions, 8 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index 3df42aabe9..89d4c145f1 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -204,8 +204,8 @@ void h263_encode_picture_header(MpegEncContext * s, int picture_number)
/* Update the pointer to last GOB */
s->ptr_lastgob = pbBufPtr(&s->pb);
put_bits(&s->pb, 22, 0x20); /* PSC */
- put_bits(&s->pb, 8, (((int64_t)s->picture_number * 30 * s->avctx->frame_rate_base) /
- s->avctx->frame_rate) & 0xff);
+ put_bits(&s->pb, 8, ((s->picture_number * 30000LL * s->avctx->frame_rate_base) /
+ (1001LL *s->avctx->frame_rate)) & 0xff); /* TemporalReference */
put_bits(&s->pb, 1, 1); /* marker */
put_bits(&s->pb, 1, 0); /* h263 id */
@@ -4891,7 +4891,10 @@ int h263_decode_picture_header(MpegEncContext *s)
return -1;
}
/* temporal reference */
- s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */
+ i = get_bits(&s->gb, 8); /* picture timestamp */
+ if( (s->picture_number&~0xFF)+i < s->picture_number)
+ i+= 256;
+ s->picture_number= (s->picture_number&~0xFF) + i;
/* PTYPE starts here */
if (get_bits1(&s->gb) != 1) {
@@ -4943,6 +4946,9 @@ int h263_decode_picture_header(MpegEncContext *s)
s->width = width;
s->height = height;
+ s->avctx->sample_aspect_ratio= (AVRational){12,11};
+ s->avctx->frame_rate = 30000;
+ s->avctx->frame_rate_base= 1001;
} else {
int ufep;
@@ -4955,7 +4961,9 @@ int h263_decode_picture_header(MpegEncContext *s)
/* OPPTYPE */
format = get_bits(&s->gb, 3);
dprintf("ufep=1, format: %d\n", format);
- skip_bits(&s->gb,1); /* Custom PCF */
+ if (get_bits1(&s->gb) != 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "Custom PCF not supported\n");
+ }
s->umvplus = get_bits(&s->gb, 1); /* Unrestricted Motion Vector */
if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n");
@@ -5028,9 +5036,12 @@ int h263_decode_picture_header(MpegEncContext *s)
} else {
width = h263_format[format][0];
height = h263_format[format][1];
+ s->avctx->sample_aspect_ratio= (AVRational){12,11};
}
if ((width == 0) || (height == 0))
return -1;
+ s->avctx->frame_rate = 30000;
+ s->avctx->frame_rate_base= 1001;
s->width = width;
s->height = height;
if (s->umvplus) {
diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref
index 0114cb9240..4a6b36f4f2 100644
--- a/tests/ffmpeg.regression.ref
+++ b/tests/ffmpeg.regression.ref
@@ -23,10 +23,10 @@ stddev: 8.10 PSNR:29.94 bytes:7602176
30dcbbe391149d981162a1f4727c43d6 *./data/a-wmv2.avi
7261e23fd8ad1de6efee022051b936be *./data/out.yuv
stddev: 8.10 PSNR:29.94 bytes:7602176
-4bf9df20cdeb1aa01115761642b4e80b *./data/a-h263.avi
+48bc3eb55962ebb5a78359727d2bf4d8 *./data/a-h263.avi
545df74e0aa443499600faedd10a7065 *./data/out.yuv
stddev: 8.18 PSNR:29.86 bytes:7602176
-920a0a8a0063655d1f34dcaad7857f98 *./data/a-h263p.avi
+a35a0d81d47e4e0c96a18ec67306db32 *./data/a-h263p.avi
0eb167c9dfcbeeecbf3debed8af8f811 *./data/out.yuv
stddev: 2.08 PSNR:41.74 bytes:7602176
1499f43271be5e95880954670620eb1f *./data/a-odivx.mp4
diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref
index 5b32ac0ce6..95f6cfdce2 100644
--- a/tests/rotozoom.regression.ref
+++ b/tests/rotozoom.regression.ref
@@ -23,10 +23,10 @@ stddev: 5.29 PSNR:33.65 bytes:7602176
ba4616dc4db0db636a7c26bc8f2de04e *./data/a-wmv2.avi
407c23671e7c7265c19c91966dbba317 *./data/out.yuv
stddev: 5.29 PSNR:33.65 bytes:7602176
-f980b5e38c4b919fbe5b660fe12fcf1a *./data/a-h263.avi
+bc321858c3b669ac2c2f47eca275c7d5 *./data/a-h263.avi
8bcc9f78373ec424e864b40734e124ba *./data/out.yuv
stddev: 5.41 PSNR:33.45 bytes:7602176
-f7828488c31ccb6787367ef4e4a2ad42 *./data/a-h263p.avi
+d669d8ac80c4f25e2008ce31ea386465 *./data/a-h263p.avi
7d39d1f272205a6a231d0e0baf32ff9d *./data/out.yuv
stddev: 1.91 PSNR:42.49 bytes:7602176
406dd7eaf5d09702d2b7164197a640a9 *./data/a-odivx.mp4