Skip to content

Commit

Permalink
Fix another sliced pix_fmt conversion artifact.
Browse files Browse the repository at this point in the history
A source with Ut Video yuv422p 360x204 was producing flickering green on
left edge.
  • Loading branch information
ddennedy committed Dec 22, 2018
1 parent 1a3329e commit fafaa42
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/modules/avformat/producer_avformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,8 @@ static int convert_image( producer_avformat self, AVFrame *frame, uint8_t *buffe

av_image_fill_arrays(ctx.out_data, ctx.out_stride, buffer, ctx.dst_format, width, height, IMAGE_ALIGN);

if ( !getenv("MLT_AVFORMAT_SLICED_PIXFMT_DISABLE") ) {
int sliced = !getenv("MLT_AVFORMAT_SLICED_PIXFMT_DISABLE");
if ( sliced ) {
ctx.slice_w = ( width < 1000 )
? ( 256 >> frame->interlaced_frame )
: ( 512 >> frame->interlaced_frame );
Expand All @@ -1459,11 +1460,12 @@ static int convert_image( producer_avformat self, AVFrame *frame, uint8_t *buffe

c = ( width + ctx.slice_w - 1 ) / ctx.slice_w;
int last_slice_w = width - ctx.slice_w * (c - 1);
c *= frame->interlaced_frame ? 2 : 1;

if ( (last_slice_w % 8) == 0 && !getenv("MLT_AVFORMAT_SLICED_PIXFMT_DISABLE") ) {
if ( sliced && (last_slice_w % 8) == 0 && !(ctx.src_format == AV_PIX_FMT_YUV422P && last_slice_w % 16) ) {
c *= frame->interlaced_frame ? 2 : 1;
mlt_slices_run_normal( c, sliced_h_pix_fmt_conv_proc, &ctx );
} else {
c = frame->interlaced_frame ? 2 : 1;
ctx.slice_w = width;
for ( i = 0 ; i < c; i++ )
sliced_h_pix_fmt_conv_proc( i, i, c, &ctx );
Expand Down

0 comments on commit fafaa42

Please sign in to comment.