[FFmpeg-devel] FFmpeg source code is no longer C99 because of GNUism called case ranges

Michael Niedermayer michaelni
Thu Jul 5 11:51:00 CEST 2007


Hi

On Thu, Jul 05, 2007 at 08:02:36AM +0100, M?ns Rullg?rd wrote:
[...]
> > +    if (avctx->sub_id < 0x20000000) {
> > +        switch(avctx->sub_id){
> > +        case 0x10000000:
> > +            s->rv10_version= 0;
> > +            s->low_delay=1;
> > +            break;
> > +        case 0x10002000:
> > +            s->rv10_version= 3;
> > +            s->low_delay=1;
> > +            s->obmc=1;
> > +            break;
> > +        case 0x10003000:
> > +        case 0x10003001:
> > +            s->rv10_version= 3;
> > +            s->low_delay=1;
> > +            break;
> > +        default:
> > +            av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id);
> > +        }
> > +    }
> > +    else if (avctx->sub_id == 0x20001000 ||
> > +             (avctx->sub_id >= 0x20100000 && avctx->sub_id < 0x201a0000)) {
> >          s->low_delay=1;
> > -        break;
> > -    case 0x10002000:
> > -        s->rv10_version= 3;
> > -        s->low_delay=1;
> > -        s->obmc=1;
> > -        break;
> > -    case 0x10003000:
> > -        s->rv10_version= 3;
> > -        s->low_delay=1;
> > -        break;
> > -    case 0x10003001:
> > -        s->rv10_version= 3;
> > -        s->low_delay=1;
> > -        break;
> > -    case 0x20001000: /* real rv20 decoder fail on this id */
> > -    /*case 0x20100001:
> > -    case 0x20101001:
> > -    case 0x20103001:*/
> > -    case 0x20100000 ... 0x2019ffff:
> > -        s->low_delay=1;
> > -        break;
> > -    /*case 0x20200002:
> > -    case 0x20201002:
> > -    case 0x20203002:*/
> > -    case 0x20200002 ... 0x202fffff:
> > -    case 0x30202002:
> > -    case 0x30203002:
> > +    }
> > +    else if (avctx->sub_id == 0x30202002 ||
> > +             avctx->sub_id == 0x30203002 ||
> > +             (avctx->sub_id >= 0x20200002 && avctx->sub_id < 0x20300000)) {
> >          s->low_delay=0;
> >          s->avctx->has_b_frames=1;
> > -        break;
> > -    default:
> > -        av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id);
> >      }
> > +    else
> > +        av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id);
> >  
> >      if(avctx->debug & FF_DEBUG_PICT_INFO){
> >          av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", avctx->sub_id, avctx->extradata_size >= 4 ? ((uint32_t*)avctx->extradata)[0] : -1);
> 
> This has the appearance of something that could possibly be done with
> some bit masking and arithmetic instead of listing all the
> possibilities.

the listing of possibilities is intended, as the listing (except the ranges)
are combinations which actually occured in files and the set flags have been
determined by trial and error
so i dont know what things mean which did not occur, some of the bits might
be flags yes ...
the first 4 bit though are the real video major version number so its not
impossible that some of this is a minor version number

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070705/db9f0e2b/attachment.pgp>



More information about the ffmpeg-devel mailing list