Mercurial > libavcodec.hg
comparison svq3.c @ 10020:617166c76faf libavcodec
Parse frame size code, see "svq3.c: parse frame size" thread on ML.
author | rbultje |
---|---|
date | Tue, 04 Aug 2009 21:55:47 +0000 |
parents | 67f917b48068 |
children | 38cfe222e1a4 |
comparison
equal
deleted
inserted
replaced
10019:c08ca946c80a | 10020:617166c76faf |
---|---|
817 | 817 |
818 /* if a match was found, parse the extra data */ | 818 /* if a match was found, parse the extra data */ |
819 if (extradata && !memcmp(extradata, "SEQH", 4)) { | 819 if (extradata && !memcmp(extradata, "SEQH", 4)) { |
820 | 820 |
821 GetBitContext gb; | 821 GetBitContext gb; |
822 int frame_size_code; | |
822 | 823 |
823 size = AV_RB32(&extradata[4]); | 824 size = AV_RB32(&extradata[4]); |
824 init_get_bits(&gb, extradata + 8, size*8); | 825 init_get_bits(&gb, extradata + 8, size*8); |
825 | 826 |
826 /* 'frame size code' and optional 'width, height' */ | 827 /* 'frame size code' and optional 'width, height' */ |
827 if (get_bits(&gb, 3) == 7) { | 828 frame_size_code = get_bits(&gb, 3); |
828 skip_bits(&gb, 12); | 829 switch (frame_size_code) { |
829 skip_bits(&gb, 12); | 830 case 0: avctx->width = 160; avctx->height = 120; break; |
831 case 1: avctx->width = 128; avctx->height = 96; break; | |
832 case 2: avctx->width = 176; avctx->height = 144; break; | |
833 case 3: avctx->width = 352; avctx->height = 288; break; | |
834 case 4: avctx->width = 704; avctx->height = 576; break; | |
835 case 5: avctx->width = 240; avctx->height = 180; break; | |
836 case 6: avctx->width = 320; avctx->height = 240; break; | |
837 case 7: | |
838 avctx->width = get_bits(&gb, 12); | |
839 avctx->height = get_bits(&gb, 12); | |
840 break; | |
830 } | 841 } |
831 | 842 |
832 h->halfpel_flag = get_bits1(&gb); | 843 h->halfpel_flag = get_bits1(&gb); |
833 h->thirdpel_flag = get_bits1(&gb); | 844 h->thirdpel_flag = get_bits1(&gb); |
834 | 845 |