These could be hazardous because of FFDrawColor's union
Unified · Split
| @@ -83,6 +83,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags) · 82 unmodified lines | ||
| 83 | 83 | unsigned i, nb_planes = 0; |
| 84 | 84 | int pixelstep[MAX_PLANES] = { 0 }; |
| 85 | 85 | int full_range = 0; |
| 86 | + int depthb = 0; | |
| 86 | 87 | |
| 87 | 88 | if (!desc || !desc->name) |
| 88 | 89 | return AVERROR(EINVAL); |
| @@ -96,6 +97,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags) · 7 unmodified lines | ||
| 96 | 97 | format == AV_PIX_FMT_YUVJ411P || format == AV_PIX_FMT_YUVJ440P) |
| 97 | 98 | full_range = 1; |
| 98 | 99 | for (i = 0; i < desc->nb_components; i++) { |
| 100 | + int db; | |
| 99 | 101 | c = &desc->comp[i]; |
| 100 | 102 | /* for now, only 8-16 bits formats */ |
| 101 | 103 | if (c->depth < 8 || c->depth > 16) |
| @@ -105,6 +107,11 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags) · 3 unmodified lines | ||
| 105 | 107 | /* data must either be in the high or low bits, never middle */ |
| 106 | 108 | if (c->shift && ((c->shift + c->depth) & 0x7)) |
| 107 | 109 | return AVERROR(ENOSYS); |
| 110 | + /* mixed >8 and <=8 depth */ | |
| 111 | + db = (c->depth + 7) / 8; | |
| 112 | + if (depthb && (depthb != db)) | |
| 113 | + return AVERROR(ENOSYS); | |
| 114 | + depthb = db; | |
| 108 | 115 | /* strange interleaving */ |
| 109 | 116 | if (pixelstep[c->plane] != 0 && |
| 110 | 117 | pixelstep[c->plane] != c->step) |