History

avfilter/vf_thumbnail: add support for rest of packed rgb formats

Paul B Mahol committed 5 years ago

Commit a7734551 parent 3b65c841 file · +30 −0Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_thumbnail.c+30−0
@@ -157,6 +157,32 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 156 unmodified lines
157157 p += frame->linesize[0];
158158 }
159159 break;
160+ case AV_PIX_FMT_RGB0:
161+ case AV_PIX_FMT_BGR0:
162+ case AV_PIX_FMT_RGBA:
163+ case AV_PIX_FMT_BGRA:
164+ for (j = 0; j < inlink->h; j++) {
165+ for (i = 0; i < inlink->w; i++) {
166+ hist[0*256 + p[i*4 ]]++;
167+ hist[1*256 + p[i*4 + 1]]++;
168+ hist[2*256 + p[i*4 + 2]]++;
169+ }
170+ p += frame->linesize[0];
171+ }
172+ break;
173+ case AV_PIX_FMT_0RGB:
174+ case AV_PIX_FMT_0BGR:
175+ case AV_PIX_FMT_ARGB:
176+ case AV_PIX_FMT_ABGR:
177+ for (j = 0; j < inlink->h; j++) {
178+ for (i = 0; i < inlink->w; i++) {
179+ hist[0*256 + p[i*4 + 1]]++;
180+ hist[1*256 + p[i*4 + 2]]++;
181+ hist[2*256 + p[i*4 + 3]]++;
182+ }
183+ p += frame->linesize[0];
184+ }
185+ break;
160186 default:
161187 for (int plane = 0; plane < 3; plane++) {
162188 const uint8_t *p = frame->data[plane];
@@ -222,6 +248,10 @@ static int query_formats(AVFilterContext *ctx) · 59 unmodified lines
222248 {
223249 static const enum AVPixelFormat pix_fmts[] = {
224250 AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
251+ AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA,
252+ AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0,
253+ AV_PIX_FMT_ABGR, AV_PIX_FMT_ARGB,
254+ AV_PIX_FMT_0BGR, AV_PIX_FMT_0RGB,
225255 AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
226256 AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
227257 AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t