Showing the changes to libavfilter (2 of 2 files). Show all
Unified · Split
| @@ -43,6 +43,7 @@ typedef struct FrameRateContext { · 42 unmodified lines | ||
| 43 | 43 | int interp_end; ///< end of range to apply linear interpolation |
| 44 | 44 | |
| 45 | 45 | int line_size[4]; ///< bytes of pixel data per line for each plane |
| 46 | + int height[4]; ///< height of each plane | |
| 46 | 47 | int vsub; |
| 47 | 48 | |
| 48 | 49 | AVRational srce_time_base; ///< timebase of source |
| @@ -95,29 +95,22 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) · 94 unmodified lines | ||
| 95 | 95 | { |
| 96 | 96 | FrameRateContext *s = ctx->priv; |
| 97 | 97 | ThreadData *td = arg; |
| 98 | + AVFrame *work = s->work; | |
| 99 | + AVFrame *src1 = td->copy_src1; | |
| 100 | + AVFrame *src2 = td->copy_src2; | |
| 98 | 101 | uint16_t src1_factor = td->src1_factor; |
| 99 | 102 | uint16_t src2_factor = td->src2_factor; |
| 100 | 103 | int plane; |
| 101 | 104 | |
| 102 | − for (plane = 0; plane < 4 && td->copy_src1->data[plane] && td->copy_src2->data[plane]; plane++) { | |
| 103 | − int cpy_line_width = s->line_size[plane]; | |
| 104 | − uint8_t *cpy_src1_data = td->copy_src1->data[plane]; | |
| 105 | − int cpy_src1_line_size = td->copy_src1->linesize[plane]; | |
| 106 | − uint8_t *cpy_src2_data = td->copy_src2->data[plane]; | |
| 107 | − int cpy_src2_line_size = td->copy_src2->linesize[plane]; | |
| 108 | − int cpy_src_h = (plane > 0 && plane < 3) ? (td->copy_src1->height >> s->vsub) : (td->copy_src1->height); | |
| 109 | − uint8_t *cpy_dst_data = s->work->data[plane]; | |
| 110 | − int cpy_dst_line_size = s->work->linesize[plane]; | |
| 111 | − const int start = (cpy_src_h * job ) / nb_jobs; | |
| 112 | − const int end = (cpy_src_h * (job+1)) / nb_jobs; | |
| 113 | − cpy_src1_data += start * cpy_src1_line_size; | |
| 114 | − cpy_src2_data += start * cpy_src2_line_size; | |
| 115 | − cpy_dst_data += start * cpy_dst_line_size; | |
| 116 | − | |
| 117 | − s->blend(cpy_src1_data, cpy_src1_line_size, | |
| 118 | − cpy_src2_data, cpy_src2_line_size, | |
| 119 | − cpy_dst_data, cpy_dst_line_size, | |
| 120 | − cpy_line_width, end - start, | |
| 105 | + for (plane = 0; plane < 4 && src1->data[plane] && src2->data[plane]; plane++) { | |
| 106 | + const int start = (s->height[plane] * job ) / nb_jobs; | |
| 107 | + const int end = (s->height[plane] * (job+1)) / nb_jobs; | |
| 108 | + uint8_t *src1_data = src1->data[plane] + start * src1->linesize[plane]; | |
| 109 | + uint8_t *src2_data = src2->data[plane] + start * src2->linesize[plane]; | |
| 110 | + uint8_t *dst_data = work->data[plane] + start * work->linesize[plane]; | |
| 111 | + | |
| 112 | + s->blend(src1_data, src1->linesize[plane], src2_data, src2->linesize[plane], | |
| 113 | + dst_data, work->linesize[plane], s->line_size[plane], end - start, | |
| 121 | 114 | src1_factor, src2_factor, s->blend_factor_max >> 1); |
| 122 | 115 | } |
| 123 | 116 | |
| @@ -293,13 +286,13 @@ static int config_input(AVFilterLink *inlink) · 169 unmodified lines | ||
| 293 | 286 | const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format); |
| 294 | 287 | int plane; |
| 295 | 288 | |
| 289 | + s->vsub = pix_desc->log2_chroma_h; | |
| 296 | 290 | for (plane = 0; plane < 4; plane++) { |
| 297 | − s->line_size[plane] = av_image_get_linesize(inlink->format, inlink->w, | |
| 298 | − plane); | |
| 291 | + s->line_size[plane] = av_image_get_linesize(inlink->format, inlink->w, plane); | |
| 292 | + s->height[plane] = inlink->h >> ((plane == 1 || plane == 2) ? s->vsub : 0); | |
| 299 | 293 | } |
| 300 | 294 | |
| 301 | 295 | s->bitdepth = pix_desc->comp[0].depth; |
| 302 | − s->vsub = pix_desc->log2_chroma_h; | |
| 303 | 296 | |
| 304 | 297 | s->sad = ff_scene_sad_get_fn(s->bitdepth == 8 ? 8 : 16); |
| 305 | 298 | if (!s->sad) |