Unified · Split
| @@ -219,8 +219,8 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) · 218 unmodified lines | ||
| 219 | 219 | YADIFContext *yadif = &s->yadif; |
| 220 | 220 | ThreadData *td = arg; |
| 221 | 221 | int linesize = yadif->cur->linesize[td->plane]; |
| 222 | − int clip_max = (1 << (yadif->csp->comp[td->plane].depth)) - 1; | |
| 223 | − int df = (yadif->csp->comp[td->plane].depth + 7) / 8; | |
| 222 | + int clip_max = (1 << (yadif->depth)) - 1; | |
| 223 | + int df = (yadif->depth + 7) / 8; | |
| 224 | 224 | int refs = linesize / df; |
| 225 | 225 | int slice_start = (td->h * jobnr ) / nb_jobs; |
| 226 | 226 | int slice_end = (td->h * (jobnr+1)) / nb_jobs; |
| @@ -267,13 +267,13 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, · 40 unmodified lines | ||
| 267 | 267 | ThreadData td = { .frame = dstpic, .parity = parity, .tff = tff }; |
| 268 | 268 | int i; |
| 269 | 269 | |
| 270 | − for (i = 0; i < yadif->csp->nb_components; i++) { | |
| 270 | + for (i = 0; i < yadif->nb_components; i++) { | |
| 271 | 271 | int w = dstpic->width; |
| 272 | 272 | int h = dstpic->height; |
| 273 | 273 | |
| 274 | 274 | if (i == 1 || i == 2) { |
| 275 | − w = AV_CEIL_RSHIFT(w, yadif->csp->log2_chroma_w); | |
| 276 | − h = AV_CEIL_RSHIFT(h, yadif->csp->log2_chroma_h); | |
| 275 | + w = AV_CEIL_RSHIFT(w, yadif->hsub); | |
| 276 | + h = AV_CEIL_RSHIFT(h, yadif->vsub); | |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | td.w = w; |
| @@ -348,9 +348,8 @@ static int config_props(AVFilterLink *link) · 68 unmodified lines | ||
| 348 | 348 | return AVERROR(EINVAL); |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | − yadif->csp = av_pix_fmt_desc_get(link->format); | |
| 352 | 351 | yadif->filter = filter; |
| 353 | − if (yadif->csp->comp[0].depth > 8) { | |
| 352 | + if (yadif->depth > 8) { | |
| 354 | 353 | s->filter_intra = filter_intra_16bit; |
| 355 | 354 | s->filter_line = filter_line_c_16bit; |
| 356 | 355 | s->filter_edge = filter_edge_16bit; |
| @@ -192,7 +192,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) · 191 unmodified lines | ||
| 192 | 192 | YADIFContext *s = ctx->priv; |
| 193 | 193 | ThreadData *td = arg; |
| 194 | 194 | int refs = s->cur->linesize[td->plane]; |
| 195 | − int df = (s->csp->comp[td->plane].depth + 7) / 8; | |
| 195 | + int df = (s->depth + 7) / 8; | |
| 196 | 196 | int pix_3 = 3 * df; |
| 197 | 197 | int slice_start = (td->h * jobnr ) / nb_jobs; |
| 198 | 198 | int slice_end = (td->h * (jobnr+1)) / nb_jobs; |
| @@ -233,13 +233,13 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, · 34 unmodified lines | ||
| 233 | 233 | ThreadData td = { .frame = dstpic, .parity = parity, .tff = tff }; |
| 234 | 234 | int i; |
| 235 | 235 | |
| 236 | − for (i = 0; i < yadif->csp->nb_components; i++) { | |
| 236 | + for (i = 0; i < yadif->nb_components; i++) { | |
| 237 | 237 | int w = dstpic->width; |
| 238 | 238 | int h = dstpic->height; |
| 239 | 239 | |
| 240 | 240 | if (i == 1 || i == 2) { |
| 241 | − w = AV_CEIL_RSHIFT(w, yadif->csp->log2_chroma_w); | |
| 242 | − h = AV_CEIL_RSHIFT(h, yadif->csp->log2_chroma_h); | |
| 241 | + w = AV_CEIL_RSHIFT(w, yadif->hsub); | |
| 242 | + h = AV_CEIL_RSHIFT(h, yadif->vsub); | |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | |
| @@ -292,6 +292,7 @@ static int config_output(AVFilterLink *outlink) · 46 unmodified lines | ||
| 292 | 292 | { |
| 293 | 293 | AVFilterContext *ctx = outlink->src; |
| 294 | 294 | YADIFContext *s = ctx->priv; |
| 295 | + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format); | |
| 295 | 296 | |
| 296 | 297 | outlink->time_base.num = ctx->inputs[0]->time_base.num; |
| 297 | 298 | outlink->time_base.den = ctx->inputs[0]->time_base.den * 2; |
| @@ -307,9 +308,12 @@ static int config_output(AVFilterLink *outlink) · 9 unmodified lines | ||
| 307 | 308 | return AVERROR(EINVAL); |
| 308 | 309 | } |
| 309 | 310 | |
| 310 | − s->csp = av_pix_fmt_desc_get(outlink->format); | |
| 311 | 311 | s->filter = filter; |
| 312 | − if (s->csp->comp[0].depth > 8) { | |
| 312 | + s->depth = desc->comp[0].depth; | |
| 313 | + s->nb_components = desc->nb_components; | |
| 314 | + s->hsub = desc->log2_chroma_w; | |
| 315 | + s->vsub = desc->log2_chroma_h; | |
| 316 | + if (s->depth > 8) { | |
| 313 | 317 | s->filter_line = filter_line_c_16bit; |
| 314 | 318 | s->filter_edges = filter_edges_16bit; |
| 315 | 319 | } else { |
| @@ -55,7 +55,7 @@ av_cold void ff_bwdif_init_x86(BWDIFContext *bwdif) · 54 unmodified lines | ||
| 55 | 55 | { |
| 56 | 56 | YADIFContext *yadif = &bwdif->yadif; |
| 57 | 57 | int cpu_flags = av_get_cpu_flags(); |
| 58 | − int bit_depth = (!yadif->csp) ? 8 : yadif->csp->comp[0].depth; | |
| 58 | + int bit_depth = yadif->depth; | |
| 59 | 59 | |
| 60 | 60 | if (bit_depth <= 8) { |
| 61 | 61 | #if ARCH_X86_32 |
| @@ -60,8 +60,7 @@ void ff_yadif_filter_line_10bit_ssse3(void *dst, void *prev, void *cur, · 59 unmodified lines | ||
| 60 | 60 | av_cold void ff_yadif_init_x86(YADIFContext *yadif) |
| 61 | 61 | { |
| 62 | 62 | int cpu_flags = av_get_cpu_flags(); |
| 63 | − int bit_depth = (!yadif->csp) ? 8 | |
| 64 | − : yadif->csp->comp[0].depth; | |
| 63 | + int bit_depth = yadif->depth; | |
| 65 | 64 | |
| 66 | 65 | if (bit_depth >= 15) { |
| 67 | 66 | #if ARCH_X86_32 |
| @@ -72,7 +72,10 @@ typedef struct YADIFContext { · 71 unmodified lines | ||
| 72 | 72 | void (*filter_edges)(void *dst, void *prev, void *cur, void *next, |
| 73 | 73 | int w, int prefs, int mrefs, int parity, int mode); |
| 74 | 74 | |
| 75 | − const AVPixFmtDescriptor *csp; | |
| 75 | + int nb_components; | |
| 76 | + int depth; | |
| 77 | + int hsub; | |
| 78 | + int vsub; | |
| 76 | 79 | int eof; |
| 77 | 80 | uint8_t *temp_line; |
| 78 | 81 | int temp_line_size; |
| @@ -69,7 +69,7 @@ static int return_frame(AVFilterContext *ctx, int is_second) · 68 unmodified lines | ||
| 69 | 69 | static int checkstride(YADIFContext *yadif, const AVFrame *a, const AVFrame *b) |
| 70 | 70 | { |
| 71 | 71 | int i; |
| 72 | − for (i = 0; i < yadif->csp->nb_components; i++) | |
| 72 | + for (i = 0; i < yadif->nb_components; i++) | |
| 73 | 73 | if (a->linesize[i] != b->linesize[i]) |
| 74 | 74 | return 1; |
| 75 | 75 | return 0; |