summaryrefslogtreecommitdiff
path: root/libavcodec/h263.c
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 /libavcodec/h263.c
parente4053d526b6aff298e7778cc23c99c80eb3c4949 (diff)
h263 framerate & aspect ratio fixes
Originally committed as revision 2854 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h263.c')
-rw-r--r--libavcodec/h263.c19
1 files changed, 15 insertions, 4 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) {