| 7212 | } |
| 7213 | |
| 7214 | static int pix_fmt_is_supported(hb_job_t *job, int pix_fmt) |
| 7215 | { |
| 7216 | const int title_bit_depth = hb_get_bit_depth(job->title->pix_fmt); |
| 7217 | const int pix_fmt_bit_depth = hb_get_bit_depth(pix_fmt); |
| 7218 | |
| 7219 | if (pix_fmt_bit_depth > title_bit_depth) |
| 7220 | { |
| 7221 | return 0; |
| 7222 | } |
| 7223 | |
| 7224 | const AVPixFmtDescriptor *title_desc = av_pix_fmt_desc_get(job->title->pix_fmt); |
| 7225 | const AVPixFmtDescriptor *pix_fmt_desc = av_pix_fmt_desc_get(pix_fmt); |
| 7226 | |
| 7227 | if (pix_fmt_desc->log2_chroma_w < title_desc->log2_chroma_w || |
| 7228 | pix_fmt_desc->log2_chroma_h < title_desc->log2_chroma_h) |
| 7229 | { |
| 7230 | return 0; |
| 7231 | } |
| 7232 | |
| 7233 | // Allow biplanar formats only if hardware decoder is enabled |
| 7234 | const int planes_count = av_pix_fmt_count_planes(pix_fmt); |
| 7235 | |
| 7236 | if (planes_count == 2) |
| 7237 | { |
| 7238 | if (job->hw_accel == NULL) |
| 7239 | { |
| 7240 | return 0; |
| 7241 | } |
| 7242 | } |
| 7243 | |
| 7244 | // These filters support only planar pixel formats |
| 7245 | for (int i = 0; i < hb_list_count(job->list_filter); i++) |
| 7246 | { |
| 7247 | hb_filter_object_t *filter = hb_list_item(job->list_filter, i); |
| 7248 | |
| 7249 | switch (filter->id) |
| 7250 | { |
| 7251 | case HB_FILTER_DETELECINE: |
| 7252 | case HB_FILTER_DECOMB: |
| 7253 | case HB_FILTER_YADIF: |
| 7254 | case HB_FILTER_BWDIF: |
| 7255 | case HB_FILTER_DENOISE: |
| 7256 | case HB_FILTER_NLMEANS: |
| 7257 | case HB_FILTER_CHROMA_SMOOTH: |
| 7258 | case HB_FILTER_LAPSHARP: |
| 7259 | case HB_FILTER_UNSHARP: |
| 7260 | case HB_FILTER_GRAYSCALE: |
| 7261 | if (planes_count == 2 && |
| 7262 | job->hw_pix_fmt != AV_PIX_FMT_VIDEOTOOLBOX) |
| 7263 | { |
| 7264 | return 0; |
| 7265 | } |
| 7266 | } |
| 7267 | } |
| 7268 | |
| 7269 | return 1; |
| 7270 | } |
| 7271 |
no test coverage detected