| 27 | #include "mpegvideodec.h" |
| 28 | |
| 29 | int ff_flv_decode_picture_header(H263DecContext *const h) |
| 30 | { |
| 31 | int format, width, height; |
| 32 | |
| 33 | /* picture header */ |
| 34 | if (get_bits(&h->gb, 17) != 1) { |
| 35 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad picture start code\n"); |
| 36 | return AVERROR_INVALIDDATA; |
| 37 | } |
| 38 | format = get_bits(&h->gb, 5); |
| 39 | if (format != 0 && format != 1) { |
| 40 | av_log(h->c.avctx, AV_LOG_ERROR, "Bad picture format\n"); |
| 41 | return AVERROR_INVALIDDATA; |
| 42 | } |
| 43 | h->flv = format; |
| 44 | h->picture_number = get_bits(&h->gb, 8); /* picture timestamp */ |
| 45 | format = get_bits(&h->gb, 3); |
| 46 | switch (format) { |
| 47 | case 0: |
| 48 | width = get_bits(&h->gb, 8); |
| 49 | height = get_bits(&h->gb, 8); |
| 50 | break; |
| 51 | case 1: |
| 52 | width = get_bits(&h->gb, 16); |
| 53 | height = get_bits(&h->gb, 16); |
| 54 | break; |
| 55 | case 2: |
| 56 | width = 352; |
| 57 | height = 288; |
| 58 | break; |
| 59 | case 3: |
| 60 | width = 176; |
| 61 | height = 144; |
| 62 | break; |
| 63 | case 4: |
| 64 | width = 128; |
| 65 | height = 96; |
| 66 | break; |
| 67 | case 5: |
| 68 | width = 320; |
| 69 | height = 240; |
| 70 | break; |
| 71 | case 6: |
| 72 | width = 160; |
| 73 | height = 120; |
| 74 | break; |
| 75 | default: |
| 76 | width = height = 0; |
| 77 | break; |
| 78 | } |
| 79 | if (av_image_check_size(width, height, 0, h->c.avctx)) |
| 80 | return AVERROR(EINVAL); |
| 81 | h->c.width = width; |
| 82 | h->c.height = height; |
| 83 | |
| 84 | h->c.pict_type = AV_PICTURE_TYPE_I + get_bits(&h->gb, 2); |
| 85 | h->c.droppable = h->c.pict_type > AV_PICTURE_TYPE_P; |
| 86 | if (h->c.droppable) |
nothing calls this directly
no test coverage detected