[FFmpeg-devel] [PATCH] PB-frames support for i263
Kostya
kostya.shishkov
Thu Feb 19 08:27:21 CET 2009
On Wed, Feb 18, 2009 at 12:43:04PM +0100, Michael Niedermayer wrote:
> On Wed, Feb 18, 2009 at 10:40:56AM +0200, Kostya wrote:
> > On Tue, Feb 17, 2009 at 06:48:57PM +0100, Michael Niedermayer wrote:
> > > On Tue, Feb 17, 2009 at 08:29:36PM +0200, Kostya wrote:
> > [..]
> > > > separated
> > > > Since i263 are the only codec known (to me) to contain PB-frames, it's the
> > > > only way to test code.
> > >
> > > huh? ITU h263+ allows PB frames, and id be surprised if there are no reference
> > > streams around ...
> >
> > I'd like to find them too.
>
> download tmn and generate your own
Will try
[for(;;){]
> > + }
> > }
> > + if(format == 6){
> > + int ar = get_bits(&s->gb, 4);
> > + skip_bits(&s->gb, 9); // display width
>
> > + if(!get_bits1(&s->gb))
> > + return -1;
>
> dont return here, just print an error
[}]
Hier
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
-------------- next part --------------
Index: libavcodec/h263.c
===================================================================
--- libavcodec/h263.c (revision 16921)
+++ libavcodec/h263.c (working copy)
@@ -6185,17 +6232,48 @@
return -1; /* SAC: off */
}
s->obmc= get_bits1(&s->gb);
- if (get_bits1(&s->gb) != 0) {
- av_log(s->avctx, AV_LOG_ERROR, "PB frame mode no supported\n");
- return -1; /* PB frame mode */
+ s->pb_frame = get_bits1(&s->gb);
+
+ if(format == 7){
+ format = get_bits(&s->gb, 3);
+ if(format == 0 || format == 7){
+ av_log(s->avctx, AV_LOG_ERROR, "Wrong Intel H263 format\n");
+ return -1;
+ }
+ if(get_bits(&s->gb, 2))
+ av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
+ s->loop_filter = get_bits1(&s->gb);
+ if(get_bits1(&s->gb)){
+ av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
+ return -1;
+ }
+ if(get_bits1(&s->gb))
+ s->pb_frame = 2;
+ if(get_bits(&s->gb, 5))
+ av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
+ if(get_bits(&s->gb, 5) != 1)
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid marker\n");
}
+ if(format == 6){
+ int ar = get_bits(&s->gb, 4);
+ skip_bits(&s->gb, 9); // display width
+ if(!get_bits1(&s->gb))
+ return -1;
+ skip_bits(&s->gb, 9); // display height
+ if(ar == 15){
+ skip_bits(&s->gb, 8); // aspect ratio - width
+ skip_bits(&s->gb, 8); // aspect ratio - height
+ }
+ }
- /* skip unknown header garbage */
- skip_bits(&s->gb, 41);
-
s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */
+ if(s->pb_frame){
+ skip_bits(&s->gb, 3); //temporal reference for B-frame
+ skip_bits(&s->gb, 2); //dbquant
+ }
+
/* PEI */
while (get_bits1(&s->gb) != 0) {
skip_bits(&s->gb, 8);
@@ -6208,6 +6286,10 @@
if(s->avctx->debug&FF_DEBUG_PICT_INFO)
show_pict_info(s);
+ if(s->pb_frame){
+ av_log(s->avctx, AV_LOG_ERROR, "PB frame mode no supported\n");
+ return -1; /* PB frame mode */
+ }
return 0;
}
Index: libavcodec/mpegvideo.h
===================================================================
--- libavcodec/mpegvideo.h (revision 16921)
+++ libavcodec/mpegvideo.h (working copy)
@@ -201,6 +201,7 @@
int bit_rate; ///< wanted bit rate
enum OutputFormat out_format; ///< output format
int h263_pred; ///< use mpeg4/h263 ac/dc predictions
+ int pb_frame; ///< PB frame mode (0 = none, 1 = base, 2 = improved)
/* the following codec id fields are deprecated in favor of codec_id */
int h263_plus; ///< h263 plus headers
More information about the ffmpeg-devel
mailing list