提交 e82d912d 编写于 作者: M Michael Niedermayer

h263 framerate & aspect ratio fixes

Originally committed as revision 2854 to svn://svn.ffmpeg.org/ffmpeg/trunk
上级 e4053d52
......@@ -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) {
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册