gstreamer/gst/deinterlace2/tvtime/tomsmocomp/StrangeBob.inc

436 lines
14 KiB
PHP
Raw Normal View History

gst/deinterlace2/: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL f... Original commit message from CVS: Based on a patch by: Martin Eikermann <meiker at upb dot de> * gst/deinterlace2/Makefile.am: * gst/deinterlace2/gstdeinterlace2.c: (gst_deinterlace2_method_get_type), (gst_deinterlace2_fields_get_type), (gst_deinterlace2_field_layout_get_type), (gst_deinterlace2_base_init), (gst_deinterlace2_class_init), (gst_deinterlace2_init), (gst_deinterlace2_set_method), (gst_deinterlace2_set_property), (gst_deinterlace2_get_property), (gst_deinterlace2_finalize), (gst_deinterlace2_pop_history), (gst_deinterlace2_head_history), (gst_deinterlace2_push_history), (gst_deinterlace2_deinterlace_scanlines), (gst_deinterlace2_chain), (gst_deinterlace2_setcaps), (gst_deinterlace2_sink_event), (gst_deinterlace2_change_state), (gst_deinterlace2_src_event), (gst_deinterlace2_src_query), (gst_deinterlace2_src_query_types), (plugin_init): * gst/deinterlace2/gstdeinterlace2.h: * gst/deinterlace2/tvtime/greedy.c: (copy_scanline), (deinterlace_greedy_packed422_scanline_mmxext), (dscaler_greedyl_get_method): * gst/deinterlace2/tvtime/greedyh.asm: * gst/deinterlace2/tvtime/greedyh.c: (deinterlace_frame_di_greedyh), (dscaler_greedyh_get_method), (greedyh_init), (greedyh_filter_mmx), (greedyh_filter_3dnow), (greedyh_filter_sse): * gst/deinterlace2/tvtime/greedyh.h: * gst/deinterlace2/tvtime/greedyhmacros.h: * gst/deinterlace2/tvtime/mmx.h: * gst/deinterlace2/tvtime/plugins.h: * gst/deinterlace2/tvtime/speedtools.h: * gst/deinterlace2/tvtime/speedy.c: (multiply_alpha), (clip255), (comb_factor_packed422_scanline_mmx), (diff_factor_packed422_scanline_c), (diff_factor_packed422_scanline_mmx), (diff_packed422_block8x8_mmx), (diff_packed422_block8x8_c), (packed444_to_packed422_scanline_c), (packed422_to_packed444_scanline_c), (packed422_to_packed444_rec601_scanline_c), (vfilter_chroma_121_packed422_scanline_mmx), (vfilter_chroma_121_packed422_scanline_c), (vfilter_chroma_332_packed422_scanline_mmx), (vfilter_chroma_332_packed422_scanline_c), (kill_chroma_packed422_inplace_scanline_mmx), (kill_chroma_packed422_inplace_scanline_c), (invert_colour_packed422_inplace_scanline_mmx), (invert_colour_packed422_inplace_scanline_c), (mirror_packed422_inplace_scanline_c), (interpolate_packed422_scanline_c), (convert_uyvy_to_yuyv_scanline_mmx), (convert_uyvy_to_yuyv_scanline_c), (interpolate_packed422_scanline_mmx), (interpolate_packed422_scanline_mmxext), (blit_colour_packed422_scanline_c), (blit_colour_packed422_scanline_mmx), (blit_colour_packed422_scanline_mmxext), (blit_colour_packed4444_scanline_c), (blit_colour_packed4444_scanline_mmx), (blit_colour_packed4444_scanline_mmxext), (small_memcpy), (speedy_memcpy_c), (speedy_memcpy_mmx), (speedy_memcpy_mmxext), (blit_packed422_scanline_c), (blit_packed422_scanline_mmx), (blit_packed422_scanline_mmxext), (composite_colour4444_alpha_to_packed422_scanline_c), (composite_colour4444_alpha_to_packed422_scanline_mmxext), (composite_packed4444_alpha_to_packed422_scanline_c), (composite_packed4444_alpha_to_packed422_scanline_mmxext), (composite_packed4444_to_packed422_scanline_c), (composite_packed4444_to_packed422_scanline_mmxext), (composite_alphamask_to_packed4444_scanline_c), (composite_alphamask_to_packed4444_scanline_mmxext), (composite_alphamask_alpha_to_packed4444_scanline_c), (premultiply_packed4444_scanline_c), (premultiply_packed4444_scanline_mmxext), (blend_packed422_scanline_c), (blend_packed422_scanline_mmxext), (quarter_blit_vertical_packed422_scanline_mmxext), (quarter_blit_vertical_packed422_scanline_c), (subpix_blit_vertical_packed422_scanline_c), (a8_subpix_blit_scanline_c), (myround), (init_RGB_to_YCbCr_tables), (init_YCbCr_to_RGB_tables), (rgb24_to_packed444_rec601_scanline_c), (rgba32_to_packed4444_rec601_scanline_c), (packed444_to_rgb24_rec601_scanline_c), (packed444_to_nonpremultiplied_packed4444_scanline_c), (aspect_adjust_packed4444_scanline_c), (setup_speedy_calls), (speedy_get_accel): * gst/deinterlace2/tvtime/speedy.h: * gst/deinterlace2/tvtime/sse.h: * gst/deinterlace2/tvtime/tomsmocomp.c: (Fieldcopy), (deinterlace_frame_di_tomsmocomp), (dscaler_tomsmocomp_get_method), (tomsmocomp_init), (tomsmocomp_filter_mmx), (tomsmocomp_filter_3dnow), (tomsmocomp_filter_sse): * gst/deinterlace2/tvtime/tomsmocomp.h: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoop0A.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopBottom.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA8.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA2.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA6.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH2.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopTop.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVAH.inc: * gst/deinterlace2/tvtime/tomsmocomp/StrangeBob.inc: * gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc: * gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll2.inc: * gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc: * gst/deinterlace2/tvtime/vfir.c: (deinterlace_line), (deinterlace_scanline_vfir), (copy_scanline), (dscaler_vfir_get_method): * gst/deinterlace2/tvtime/x86-64_macros.inc: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL for GStreamer and in theory provides better and faster results than the simple deinterlace element. Fixes bug #163578. Ported to GStreamer 0.10 but still not enabled or included in the build system by default because of bad artefacts caused by a bug somewhere and as it can be only build on x86/amd64 ATM and requires special CFLAGS. Will be fixed soon.
2008-06-11 11:12:49 +00:00
// -*- c++ -*-
// First, get and save our possible Bob values
// Assume our pixels are layed out as follows with x the calc'd bob value
// and the other pixels are from the current field
//
// j a b c k current field
gst/deinterlace2/: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL f... Original commit message from CVS: Based on a patch by: Martin Eikermann <meiker at upb dot de> * gst/deinterlace2/Makefile.am: * gst/deinterlace2/gstdeinterlace2.c: (gst_deinterlace2_method_get_type), (gst_deinterlace2_fields_get_type), (gst_deinterlace2_field_layout_get_type), (gst_deinterlace2_base_init), (gst_deinterlace2_class_init), (gst_deinterlace2_init), (gst_deinterlace2_set_method), (gst_deinterlace2_set_property), (gst_deinterlace2_get_property), (gst_deinterlace2_finalize), (gst_deinterlace2_pop_history), (gst_deinterlace2_head_history), (gst_deinterlace2_push_history), (gst_deinterlace2_deinterlace_scanlines), (gst_deinterlace2_chain), (gst_deinterlace2_setcaps), (gst_deinterlace2_sink_event), (gst_deinterlace2_change_state), (gst_deinterlace2_src_event), (gst_deinterlace2_src_query), (gst_deinterlace2_src_query_types), (plugin_init): * gst/deinterlace2/gstdeinterlace2.h: * gst/deinterlace2/tvtime/greedy.c: (copy_scanline), (deinterlace_greedy_packed422_scanline_mmxext), (dscaler_greedyl_get_method): * gst/deinterlace2/tvtime/greedyh.asm: * gst/deinterlace2/tvtime/greedyh.c: (deinterlace_frame_di_greedyh), (dscaler_greedyh_get_method), (greedyh_init), (greedyh_filter_mmx), (greedyh_filter_3dnow), (greedyh_filter_sse): * gst/deinterlace2/tvtime/greedyh.h: * gst/deinterlace2/tvtime/greedyhmacros.h: * gst/deinterlace2/tvtime/mmx.h: * gst/deinterlace2/tvtime/plugins.h: * gst/deinterlace2/tvtime/speedtools.h: * gst/deinterlace2/tvtime/speedy.c: (multiply_alpha), (clip255), (comb_factor_packed422_scanline_mmx), (diff_factor_packed422_scanline_c), (diff_factor_packed422_scanline_mmx), (diff_packed422_block8x8_mmx), (diff_packed422_block8x8_c), (packed444_to_packed422_scanline_c), (packed422_to_packed444_scanline_c), (packed422_to_packed444_rec601_scanline_c), (vfilter_chroma_121_packed422_scanline_mmx), (vfilter_chroma_121_packed422_scanline_c), (vfilter_chroma_332_packed422_scanline_mmx), (vfilter_chroma_332_packed422_scanline_c), (kill_chroma_packed422_inplace_scanline_mmx), (kill_chroma_packed422_inplace_scanline_c), (invert_colour_packed422_inplace_scanline_mmx), (invert_colour_packed422_inplace_scanline_c), (mirror_packed422_inplace_scanline_c), (interpolate_packed422_scanline_c), (convert_uyvy_to_yuyv_scanline_mmx), (convert_uyvy_to_yuyv_scanline_c), (interpolate_packed422_scanline_mmx), (interpolate_packed422_scanline_mmxext), (blit_colour_packed422_scanline_c), (blit_colour_packed422_scanline_mmx), (blit_colour_packed422_scanline_mmxext), (blit_colour_packed4444_scanline_c), (blit_colour_packed4444_scanline_mmx), (blit_colour_packed4444_scanline_mmxext), (small_memcpy), (speedy_memcpy_c), (speedy_memcpy_mmx), (speedy_memcpy_mmxext), (blit_packed422_scanline_c), (blit_packed422_scanline_mmx), (blit_packed422_scanline_mmxext), (composite_colour4444_alpha_to_packed422_scanline_c), (composite_colour4444_alpha_to_packed422_scanline_mmxext), (composite_packed4444_alpha_to_packed422_scanline_c), (composite_packed4444_alpha_to_packed422_scanline_mmxext), (composite_packed4444_to_packed422_scanline_c), (composite_packed4444_to_packed422_scanline_mmxext), (composite_alphamask_to_packed4444_scanline_c), (composite_alphamask_to_packed4444_scanline_mmxext), (composite_alphamask_alpha_to_packed4444_scanline_c), (premultiply_packed4444_scanline_c), (premultiply_packed4444_scanline_mmxext), (blend_packed422_scanline_c), (blend_packed422_scanline_mmxext), (quarter_blit_vertical_packed422_scanline_mmxext), (quarter_blit_vertical_packed422_scanline_c), (subpix_blit_vertical_packed422_scanline_c), (a8_subpix_blit_scanline_c), (myround), (init_RGB_to_YCbCr_tables), (init_YCbCr_to_RGB_tables), (rgb24_to_packed444_rec601_scanline_c), (rgba32_to_packed4444_rec601_scanline_c), (packed444_to_rgb24_rec601_scanline_c), (packed444_to_nonpremultiplied_packed4444_scanline_c), (aspect_adjust_packed4444_scanline_c), (setup_speedy_calls), (speedy_get_accel): * gst/deinterlace2/tvtime/speedy.h: * gst/deinterlace2/tvtime/sse.h: * gst/deinterlace2/tvtime/tomsmocomp.c: (Fieldcopy), (deinterlace_frame_di_tomsmocomp), (dscaler_tomsmocomp_get_method), (tomsmocomp_init), (tomsmocomp_filter_mmx), (tomsmocomp_filter_3dnow), (tomsmocomp_filter_sse): * gst/deinterlace2/tvtime/tomsmocomp.h: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoop0A.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopBottom.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA8.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA2.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA6.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH2.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopTop.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVAH.inc: * gst/deinterlace2/tvtime/tomsmocomp/StrangeBob.inc: * gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc: * gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll2.inc: * gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc: * gst/deinterlace2/tvtime/vfir.c: (deinterlace_line), (deinterlace_scanline_vfir), (copy_scanline), (dscaler_vfir_get_method): * gst/deinterlace2/tvtime/x86-64_macros.inc: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL for GStreamer and in theory provides better and faster results than the simple deinterlace element. Fixes bug #163578. Ported to GStreamer 0.10 but still not enabled or included in the build system by default because of bad artefacts caused by a bug somewhere and as it can be only build on x86/amd64 ATM and requires special CFLAGS. Will be fixed soon.
2008-06-11 11:12:49 +00:00
// x calculated line
// m d e f n current field
//
// we calc the bob value luma value as:
// if |j - n| < Thres && |a - m| > Thres
// avg(j,n)
// end if
// if |k - m| < Thres && |c - n| > Thres
// avg(k,m)
// end if
// if |c - d| < Thres && |b - f| > Thres
// avg(c,d)
// end if
// if |a - f| < Thres && |b - d| > Thres
// avg(a,f)
// end if
// if |b - e| < Thres
// avg(b,e)
// end if
// pickup any thing not yet set with avg(b,e)
#ifndef IS_C
gst/deinterlace2/: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL f... Original commit message from CVS: Based on a patch by: Martin Eikermann <meiker at upb dot de> * gst/deinterlace2/Makefile.am: * gst/deinterlace2/gstdeinterlace2.c: (gst_deinterlace2_method_get_type), (gst_deinterlace2_fields_get_type), (gst_deinterlace2_field_layout_get_type), (gst_deinterlace2_base_init), (gst_deinterlace2_class_init), (gst_deinterlace2_init), (gst_deinterlace2_set_method), (gst_deinterlace2_set_property), (gst_deinterlace2_get_property), (gst_deinterlace2_finalize), (gst_deinterlace2_pop_history), (gst_deinterlace2_head_history), (gst_deinterlace2_push_history), (gst_deinterlace2_deinterlace_scanlines), (gst_deinterlace2_chain), (gst_deinterlace2_setcaps), (gst_deinterlace2_sink_event), (gst_deinterlace2_change_state), (gst_deinterlace2_src_event), (gst_deinterlace2_src_query), (gst_deinterlace2_src_query_types), (plugin_init): * gst/deinterlace2/gstdeinterlace2.h: * gst/deinterlace2/tvtime/greedy.c: (copy_scanline), (deinterlace_greedy_packed422_scanline_mmxext), (dscaler_greedyl_get_method): * gst/deinterlace2/tvtime/greedyh.asm: * gst/deinterlace2/tvtime/greedyh.c: (deinterlace_frame_di_greedyh), (dscaler_greedyh_get_method), (greedyh_init), (greedyh_filter_mmx), (greedyh_filter_3dnow), (greedyh_filter_sse): * gst/deinterlace2/tvtime/greedyh.h: * gst/deinterlace2/tvtime/greedyhmacros.h: * gst/deinterlace2/tvtime/mmx.h: * gst/deinterlace2/tvtime/plugins.h: * gst/deinterlace2/tvtime/speedtools.h: * gst/deinterlace2/tvtime/speedy.c: (multiply_alpha), (clip255), (comb_factor_packed422_scanline_mmx), (diff_factor_packed422_scanline_c), (diff_factor_packed422_scanline_mmx), (diff_packed422_block8x8_mmx), (diff_packed422_block8x8_c), (packed444_to_packed422_scanline_c), (packed422_to_packed444_scanline_c), (packed422_to_packed444_rec601_scanline_c), (vfilter_chroma_121_packed422_scanline_mmx), (vfilter_chroma_121_packed422_scanline_c), (vfilter_chroma_332_packed422_scanline_mmx), (vfilter_chroma_332_packed422_scanline_c), (kill_chroma_packed422_inplace_scanline_mmx), (kill_chroma_packed422_inplace_scanline_c), (invert_colour_packed422_inplace_scanline_mmx), (invert_colour_packed422_inplace_scanline_c), (mirror_packed422_inplace_scanline_c), (interpolate_packed422_scanline_c), (convert_uyvy_to_yuyv_scanline_mmx), (convert_uyvy_to_yuyv_scanline_c), (interpolate_packed422_scanline_mmx), (interpolate_packed422_scanline_mmxext), (blit_colour_packed422_scanline_c), (blit_colour_packed422_scanline_mmx), (blit_colour_packed422_scanline_mmxext), (blit_colour_packed4444_scanline_c), (blit_colour_packed4444_scanline_mmx), (blit_colour_packed4444_scanline_mmxext), (small_memcpy), (speedy_memcpy_c), (speedy_memcpy_mmx), (speedy_memcpy_mmxext), (blit_packed422_scanline_c), (blit_packed422_scanline_mmx), (blit_packed422_scanline_mmxext), (composite_colour4444_alpha_to_packed422_scanline_c), (composite_colour4444_alpha_to_packed422_scanline_mmxext), (composite_packed4444_alpha_to_packed422_scanline_c), (composite_packed4444_alpha_to_packed422_scanline_mmxext), (composite_packed4444_to_packed422_scanline_c), (composite_packed4444_to_packed422_scanline_mmxext), (composite_alphamask_to_packed4444_scanline_c), (composite_alphamask_to_packed4444_scanline_mmxext), (composite_alphamask_alpha_to_packed4444_scanline_c), (premultiply_packed4444_scanline_c), (premultiply_packed4444_scanline_mmxext), (blend_packed422_scanline_c), (blend_packed422_scanline_mmxext), (quarter_blit_vertical_packed422_scanline_mmxext), (quarter_blit_vertical_packed422_scanline_c), (subpix_blit_vertical_packed422_scanline_c), (a8_subpix_blit_scanline_c), (myround), (init_RGB_to_YCbCr_tables), (init_YCbCr_to_RGB_tables), (rgb24_to_packed444_rec601_scanline_c), (rgba32_to_packed4444_rec601_scanline_c), (packed444_to_rgb24_rec601_scanline_c), (packed444_to_nonpremultiplied_packed4444_scanline_c), (aspect_adjust_packed4444_scanline_c), (setup_speedy_calls), (speedy_get_accel): * gst/deinterlace2/tvtime/speedy.h: * gst/deinterlace2/tvtime/sse.h: * gst/deinterlace2/tvtime/tomsmocomp.c: (Fieldcopy), (deinterlace_frame_di_tomsmocomp), (dscaler_tomsmocomp_get_method), (tomsmocomp_init), (tomsmocomp_filter_mmx), (tomsmocomp_filter_3dnow), (tomsmocomp_filter_sse): * gst/deinterlace2/tvtime/tomsmocomp.h: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoop0A.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopBottom.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA8.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA2.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA6.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH2.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopTop.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVAH.inc: * gst/deinterlace2/tvtime/tomsmocomp/StrangeBob.inc: * gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc: * gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll2.inc: * gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc: * gst/deinterlace2/tvtime/vfir.c: (deinterlace_line), (deinterlace_scanline_vfir), (copy_scanline), (dscaler_vfir_get_method): * gst/deinterlace2/tvtime/x86-64_macros.inc: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL for GStreamer and in theory provides better and faster results than the simple deinterlace element. Fixes bug #163578. Ported to GStreamer 0.10 but still not enabled or included in the build system by default because of bad artefacts caused by a bug somewhere and as it can be only build on x86/amd64 ATM and requires special CFLAGS. Will be fixed soon.
2008-06-11 11:12:49 +00:00
// j, n
"pxor %%mm5, %%mm5\n\t"
"pxor %%mm6, %%mm6\n\t"
"pxor %%mm7, %%mm7\n\t"
"movq -2(%%"XBX"), %%mm0\n\t" // value a from top left
"movq -4(%%"XBX", %%"XCX"), %%mm1\n\t" // value m from bottom right
"movq %%mm0, %%mm3\n\t"
"psubusb %%mm1, %%mm3\n\t"
"psubusb %%mm0, %%mm1\n\t"
"por %%mm1, %%mm3\n\t" // abs(a,m)
"psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(a,m) > Thres else 0
"pxor %%mm4, %%mm4\n\t"
"pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(a,m) < Thres, else 00
"pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(a,m) > Thres, else 00
"movq -4(%%"XBX"), %%mm0\n\t" // value j
"movq 4(%%"XBX", %%"XCX"), %%mm1\n\t" // value n
"movq %%mm0, %%mm2\n\t"
V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(j,n)
gst/deinterlace2/: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL f... Original commit message from CVS: Based on a patch by: Martin Eikermann <meiker at upb dot de> * gst/deinterlace2/Makefile.am: * gst/deinterlace2/gstdeinterlace2.c: (gst_deinterlace2_method_get_type), (gst_deinterlace2_fields_get_type), (gst_deinterlace2_field_layout_get_type), (gst_deinterlace2_base_init), (gst_deinterlace2_class_init), (gst_deinterlace2_init), (gst_deinterlace2_set_method), (gst_deinterlace2_set_property), (gst_deinterlace2_get_property), (gst_deinterlace2_finalize), (gst_deinterlace2_pop_history), (gst_deinterlace2_head_history), (gst_deinterlace2_push_history), (gst_deinterlace2_deinterlace_scanlines), (gst_deinterlace2_chain), (gst_deinterlace2_setcaps), (gst_deinterlace2_sink_event), (gst_deinterlace2_change_state), (gst_deinterlace2_src_event), (gst_deinterlace2_src_query), (gst_deinterlace2_src_query_types), (plugin_init): * gst/deinterlace2/gstdeinterlace2.h: * gst/deinterlace2/tvtime/greedy.c: (copy_scanline), (deinterlace_greedy_packed422_scanline_mmxext), (dscaler_greedyl_get_method): * gst/deinterlace2/tvtime/greedyh.asm: * gst/deinterlace2/tvtime/greedyh.c: (deinterlace_frame_di_greedyh), (dscaler_greedyh_get_method), (greedyh_init), (greedyh_filter_mmx), (greedyh_filter_3dnow), (greedyh_filter_sse): * gst/deinterlace2/tvtime/greedyh.h: * gst/deinterlace2/tvtime/greedyhmacros.h: * gst/deinterlace2/tvtime/mmx.h: * gst/deinterlace2/tvtime/plugins.h: * gst/deinterlace2/tvtime/speedtools.h: * gst/deinterlace2/tvtime/speedy.c: (multiply_alpha), (clip255), (comb_factor_packed422_scanline_mmx), (diff_factor_packed422_scanline_c), (diff_factor_packed422_scanline_mmx), (diff_packed422_block8x8_mmx), (diff_packed422_block8x8_c), (packed444_to_packed422_scanline_c), (packed422_to_packed444_scanline_c), (packed422_to_packed444_rec601_scanline_c), (vfilter_chroma_121_packed422_scanline_mmx), (vfilter_chroma_121_packed422_scanline_c), (vfilter_chroma_332_packed422_scanline_mmx), (vfilter_chroma_332_packed422_scanline_c), (kill_chroma_packed422_inplace_scanline_mmx), (kill_chroma_packed422_inplace_scanline_c), (invert_colour_packed422_inplace_scanline_mmx), (invert_colour_packed422_inplace_scanline_c), (mirror_packed422_inplace_scanline_c), (interpolate_packed422_scanline_c), (convert_uyvy_to_yuyv_scanline_mmx), (convert_uyvy_to_yuyv_scanline_c), (interpolate_packed422_scanline_mmx), (interpolate_packed422_scanline_mmxext), (blit_colour_packed422_scanline_c), (blit_colour_packed422_scanline_mmx), (blit_colour_packed422_scanline_mmxext), (blit_colour_packed4444_scanline_c), (blit_colour_packed4444_scanline_mmx), (blit_colour_packed4444_scanline_mmxext), (small_memcpy), (speedy_memcpy_c), (speedy_memcpy_mmx), (speedy_memcpy_mmxext), (blit_packed422_scanline_c), (blit_packed422_scanline_mmx), (blit_packed422_scanline_mmxext), (composite_colour4444_alpha_to_packed422_scanline_c), (composite_colour4444_alpha_to_packed422_scanline_mmxext), (composite_packed4444_alpha_to_packed422_scanline_c), (composite_packed4444_alpha_to_packed422_scanline_mmxext), (composite_packed4444_to_packed422_scanline_c), (composite_packed4444_to_packed422_scanline_mmxext), (composite_alphamask_to_packed4444_scanline_c), (composite_alphamask_to_packed4444_scanline_mmxext), (composite_alphamask_alpha_to_packed4444_scanline_c), (premultiply_packed4444_scanline_c), (premultiply_packed4444_scanline_mmxext), (blend_packed422_scanline_c), (blend_packed422_scanline_mmxext), (quarter_blit_vertical_packed422_scanline_mmxext), (quarter_blit_vertical_packed422_scanline_c), (subpix_blit_vertical_packed422_scanline_c), (a8_subpix_blit_scanline_c), (myround), (init_RGB_to_YCbCr_tables), (init_YCbCr_to_RGB_tables), (rgb24_to_packed444_rec601_scanline_c), (rgba32_to_packed4444_rec601_scanline_c), (packed444_to_rgb24_rec601_scanline_c), (packed444_to_nonpremultiplied_packed4444_scanline_c), (aspect_adjust_packed4444_scanline_c), (setup_speedy_calls), (speedy_get_accel): * gst/deinterlace2/tvtime/speedy.h: * gst/deinterlace2/tvtime/sse.h: * gst/deinterlace2/tvtime/tomsmocomp.c: (Fieldcopy), (deinterlace_frame_di_tomsmocomp), (dscaler_tomsmocomp_get_method), (tomsmocomp_init), (tomsmocomp_filter_mmx), (tomsmocomp_filter_3dnow), (tomsmocomp_filter_sse): * gst/deinterlace2/tvtime/tomsmocomp.h: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoop0A.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopBottom.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA8.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA2.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA6.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH2.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopTop.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVAH.inc: * gst/deinterlace2/tvtime/tomsmocomp/StrangeBob.inc: * gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc: * gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll2.inc: * gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc: * gst/deinterlace2/tvtime/vfir.c: (deinterlace_line), (deinterlace_scanline_vfir), (copy_scanline), (dscaler_vfir_get_method): * gst/deinterlace2/tvtime/x86-64_macros.inc: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL for GStreamer and in theory provides better and faster results than the simple deinterlace element. Fixes bug #163578. Ported to GStreamer 0.10 but still not enabled or included in the build system by default because of bad artefacts caused by a bug somewhere and as it can be only build on x86/amd64 ATM and requires special CFLAGS. Will be fixed soon.
2008-06-11 11:12:49 +00:00
"movq %%mm0, %%mm3\n\t"
"psubusb %%mm1, %%mm0\n\t"
"psubusb %%mm3, %%mm1\n\t"
"por %%mm1, %%mm0\n\t" // abs(j,n)
"movq %%mm0, %%mm1\n\t"
"psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(j,n) > Thres else 0
"pxor %%mm3, %%mm3\n\t"
"pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(j,n) < Thres, else 00
"pand %%mm4, %%mm1\n\t"
"pand %%mm1, %%mm2\n\t"
"pand %%mm1, %%mm0\n\t"
"movq %%mm1, %%mm3\n\t"
"pxor %%mm5, %%mm3\n\t"
"pand %%mm3, %%mm6\n\t"
"pand %%mm3, %%mm7\n\t"
"pand %%mm3, %%mm5\n\t"
"por %%mm1, %%mm5\n\t"
"por %%mm2, %%mm6\n\t"
"por %%mm0, %%mm7\n\t"
// k & m
"movq 2(%%"XBX"), %%mm0\n\t" // value c from top left
"movq 4(%%"XBX", %%"XCX"), %%mm1\n\t" // value n from bottom right
"movq %%mm0, %%mm3\n\t"
"psubusb %%mm1, %%mm3\n\t"
"psubusb %%mm0, %%mm1\n\t"
"por %%mm1, %%mm3\n\t" // abs(c,n)
"psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(c,n) > Thres else 0
"pxor %%mm4, %%mm4\n\t"
"pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(c,n) < Thres, else 00
"pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(c,n) > Thres, else 00
"movq 4(%%"XBX"), %%mm0\n\t" // value k
"movq -4(%%"XBX", %%"XCX"), %%mm1\n\t" // value m
"movq %%mm0, %%mm2\n\t"
V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(k,m)
"movq %%mm0, %%mm3\n\t"
"psubusb %%mm1, %%mm0\n\t"
"psubusb %%mm3, %%mm1\n\t"
"por %%mm1, %%mm0\n\t" // abs(k,m)
"movq %%mm0, %%mm1\n\t"
"psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(k,m) > Thres else 0
"pxor %%mm3, %%mm3\n\t"
"pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(k,m) < Thres, else 00
"pand %%mm4, %%mm1\n\t"
"pand %%mm1, %%mm2\n\t"
"pand %%mm1, %%mm0\n\t"
"movq %%mm1, %%mm3\n\t"
"pxor %%mm5, %%mm3\n\t"
"pand %%mm3, %%mm6\n\t"
"pand %%mm3, %%mm7\n\t"
"pand %%mm3, %%mm5\n\t"
"por %%mm1, %%mm5\n\t"
"por %%mm2, %%mm6\n\t"
"por %%mm0, %%mm7\n\t"
// c & d
"movq (%%"XBX"), %%mm0\n\t" // value b from top left
"movq 2(%%"XBX", %%"XCX"), %%mm1\n\t" // value f from bottom right
"movq %%mm0, %%mm3\n\t"
"psubusb %%mm1, %%mm3\n\t"
"psubusb %%mm0, %%mm1\n\t"
"por %%mm1, %%mm3\n\t" // abs(b,f)
"psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(b,f) > Thres else 0
"pxor %%mm4, %%mm4\n\t"
"pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(b,f) < Thres, else 00
"pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(b,f) > Thres, else 00
"movq 2(%%"XBX"), %%mm0\n\t" // value c
"movq -2(%%"XBX", %%"XCX"), %%mm1\n\t" // value d
"movq %%mm0, %%mm2\n\t"
V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(c,d)
"movq %%mm0, %%mm3\n\t"
"psubusb %%mm1, %%mm0\n\t"
"psubusb %%mm3, %%mm1\n\t"
"por %%mm1, %%mm0\n\t" // abs(c,d)
"movq %%mm0, %%mm1\n\t"
"psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(c,d) > Thres else 0
"pxor %%mm3, %%mm3\n\t"
"pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(c,d) < Thres, else 00
"pand %%mm4, %%mm1\n\t"
"pand %%mm1, %%mm2\n\t"
"pand %%mm1, %%mm0\n\t"
"movq %%mm1, %%mm3\n\t"
"pxor %%mm5, %%mm3\n\t"
"pand %%mm3, %%mm6\n\t"
"pand %%mm3, %%mm7\n\t"
"pand %%mm3, %%mm5\n\t"
"por %%mm1, %%mm5\n\t"
"por %%mm2, %%mm6\n\t"
"por %%mm0, %%mm7\n\t"
// a & f
"movq (%%"XBX"), %%mm0\n\t" // value b from top left
"movq -2(%%"XBX", %%"XCX"), %%mm1\n\t" // value d from bottom right
"movq %%mm0, %%mm3\n\t"
"psubusb %%mm1, %%mm3\n\t"
"psubusb %%mm0, %%mm1\n\t"
"por %%mm1, %%mm3\n\t" // abs(b,d)
"psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(b,d) > Thres else 0
"pxor %%mm4, %%mm4\n\t"
"pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(b,d) < Thres, else 00
"pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(b,d) > Thres, else 00
"movq -2(%%"XBX"), %%mm0\n\t" // value a
"movq 2(%%"XBX", %%"XCX"), %%mm1\n\t" // value f
"movq %%mm0, %%mm2\n\t"
V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(a,f)
"movq %%mm0, %%mm3\n\t"
"psubusb %%mm1, %%mm0\n\t"
"psubusb %%mm3, %%mm1\n\t"
"por %%mm1, %%mm0\n\t" // abs(a,f)
"movq %%mm0, %%mm1\n\t"
"psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(a,f) > Thres else 0
"pxor %%mm3, %%mm3\n\t"
"pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(a,f) < Thres, else 00
"pand %%mm4, %%mm1\n\t"
"pand %%mm1, %%mm2\n\t"
"pand %%mm1, %%mm0\n\t"
"movq %%mm1, %%mm3\n\t"
"pxor %%mm5, %%mm3\n\t"
"pand %%mm3, %%mm6\n\t"
"pand %%mm3, %%mm7\n\t"
"pand %%mm3, %%mm5\n\t"
"por %%mm1, %%mm5\n\t"
"por %%mm2, %%mm6\n\t"
"por %%mm0, %%mm7\n\t"
"pand "_YMask", %%mm5\n\t" // mask out chroma from here
"pand "_YMask", %%mm6\n\t" // mask out chroma from here
"pand "_YMask", %%mm7\n\t" // mask out chroma from here
// b,e
"movq (%%"XBX"), %%mm0\n\t" // value b from top
"movq (%%"XBX", %%"XCX"), %%mm1\n\t" // value e from bottom
"movq %%mm0, %%mm2\n\t"
V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(b,e)
"movq %%mm0, %%mm3\n\t"
"psubusb %%mm1, %%mm0\n\t"
"psubusb %%mm3, %%mm1\n\t"
"por %%mm1, %%mm0\n\t" // abs(b,e)
"movq %%mm0, %%mm1\n\t"
"psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(b,e) > Thres else 0
"pxor %%mm3, %%mm3\n\t"
"pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(b,e) < Thres, else 00
"pand %%mm1, %%mm2\n\t"
"pand %%mm1, %%mm0\n\t"
"movq %%mm1, %%mm3\n\t"
"pxor %%mm5, %%mm3\n\t"
"pand %%mm3, %%mm6\n\t"
"pand %%mm3, %%mm7\n\t"
"pand %%mm3, %%mm5\n\t"
"por %%mm1, %%mm5\n\t"
"por %%mm2, %%mm6\n\t"
"por %%mm0, %%mm7\n\t"
// bob in any leftovers
"movq (%%"XBX"), %%mm0\n\t" // value b from top
"movq (%%"XBX", %%"XCX"), %%mm1\n\t" // value e from bottom
// We will also calc here the max/min values to later limit comb
// so the max excursion will not exceed the Max_Comb constant
#ifdef SKIP_SEARCH
"movq %%mm0, %%mm2\n\t"
// pminub %%mm2, %%mm1
V_PMINUB ("%%mm2", "%%mm1", "%%mm4")
// pmaxub %%mm6, %%mm2 // clip our current results so far to be above this
V_PMAXUB ("%%mm6", "%%mm2")
"movq %%mm0, %%mm2\n\t"
V_PMAXUB ("%%mm2", "%%mm1")
// pminub %%mm6, %%mm2 // clip our current results so far to be below this
V_PMINUB ("%%mm6", "%%mm2", "%%mm4")
#else
"movq %%mm0, %%mm2\n\t"
"movq (%%"XAX"), %%mm4\n\t"
"psubusb %%mm4, %%mm2\n\t"
"psubusb %%mm0, %%mm4\n\t"
"por %%mm2, %%mm4\n\t" // abs diff
"movq %%mm1, %%mm2\n\t"
"movq (%%"XAX", %%"XCX"), %%mm3\n\t"
"psubusb %%mm3, %%mm2\n\t"
"psubusb %%mm1, %%mm3\n\t"
"por %%mm2, %%mm3\n\t" // abs diff
// pmaxub %%mm3, %%mm4 // top or bottom pixel moved most
V_PMAXUB ("%%mm3", "%%mm4") // top or bottom pixel moved most
"psubusb "_DiffThres", %%mm3\n\t" // moved more than allowed? or goes to 0?
"pxor %%mm4, %%mm4\n\t"
"pcmpeqb %%mm4, %%mm3\n\t" // now ff where low motion, else high motion
"movq %%mm0, %%mm2\n\t"
// pminub %%mm2, %%mm1
V_PMINUB ("%%mm2", "%%mm1", "%%mm4")
// pmaxub %%mm6, %%mm2 // clip our current results so far to be above this
V_PMAXUB ("%%mm6", "%%mm2")
"psubusb %%mm3, %%mm2\n\t" // maybe decrease it to 0000.. if no surround motion
"movq %%mm2, "_Min_Vals"\n\t"
"movq %%mm0, %%mm2\n\t"
V_PMAXUB ("%%mm2", "%%mm1")
// pminub %%mm6, %%mm2 // clip our current results so far to be below this
V_PMINUB ("%%mm6", "%%mm2", "%%mm4")
"paddusb %%mm3, %%mm2\n\t" // maybe increase it to ffffff if no surround motion
"movq %%mm2, "_Max_Vals"\n\t"
#endif
"movq %%mm0, %%mm2\n\t"
// pavgb %%mm2, %%mm1 // avg(b,e)
V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(b,e)
"movq %%mm0, %%mm3\n\t"
"psubusb %%mm1, %%mm3\n\t"
"psubusb %%mm0, %%mm1\n\t"
"por %%mm1, %%mm3\n\t" // abs(b,e)
"movq %%mm3, %%mm1\n\t" // keep copy of diffs
"pxor %%mm4, %%mm4\n\t"
"psubusb %%mm7, %%mm3\n\t" // nonzero where new weights bigger, else 0
"pcmpeqb %%mm4, %%mm3\n\t" // now ff where new better, else 00
"pcmpeqb %%mm0, %%mm0\n\t"
"pandn %%mm0, %%mm5\n\t"
"por %%mm5, %%mm3\n\t"
"pcmpeqb %%mm3, %%mm4\n\t" // here ff where old better, else 00
"pand %%mm3, %%mm1\n\t"
"pand %%mm3, %%mm2\n\t"
"pand %%mm4, %%mm6\n\t"
"pand %%mm4, %%mm7\n\t"
"por %%mm2, %%mm6\n\t" // our x2 value
"por %%mm1, %%mm7\n\t" // our x2 diffs
"movq %%mm7, %%mm4\n\t" // save as bob uncertainty indicator
#else
diff[0] = -1;
diff[1] = -1;
best[0] = 0;
best[1] = 0;
// j, n
if (ABS (pBob[-2] - pBob[src_pitch2 - 4]) < DiffThres &&
ABS (pBob[-4] - pBob[src_pitch2 + 4]) > DiffThres) {
best[0] = (pBob[-2] + pBob[src_pitch2 - 4]) / 2;
diff[0] = ABS (pBob[-2] - pBob[src_pitch2 - 4]);
}
if (ABS (pBob[-1] - pBob[src_pitch2 - 3]) < DiffThres &&
ABS (pBob[-3] - pBob[src_pitch2 + 5]) > DiffThres) {
best[1] = (pBob[-1] + pBob[src_pitch2 - 3]) / 2;
diff[1] = ABS (pBob[-1] - pBob[src_pitch2 - 3]);
}
// k & m
if (ABS (pBob[2] - pBob[src_pitch2 + 4]) < DiffThres &&
ABS (pBob[4] - pBob[src_pitch2 - 4]) > DiffThres) {
best[0] = (pBob[4] + pBob[src_pitch2 - 4]) / 2;
diff[0] = ABS (pBob[4] - pBob[src_pitch2 - 4]);
}
if (ABS (pBob[3] - pBob[src_pitch2 + 5]) < DiffThres &&
ABS (pBob[5] - pBob[src_pitch2 - 3]) > DiffThres) {
best[1] = (pBob[5] + pBob[src_pitch2 - 3]) / 2;
diff[1] = ABS (pBob[5] - pBob[src_pitch2 - 3]);
}
// c & d
if (ABS (pBob[0] - pBob[src_pitch2 + 2]) < DiffThres &&
ABS (pBob[2] - pBob[src_pitch2 - 2]) > DiffThres) {
best[0] = (pBob[2] + pBob[src_pitch2 - 2]) / 2;
diff[0] = ABS (pBob[2] - pBob[src_pitch2 - 2]);
}
if (ABS (pBob[1] - pBob[src_pitch2 + 3]) < DiffThres &&
ABS (pBob[3] - pBob[src_pitch2 - 1]) > DiffThres) {
best[1] = (pBob[3] + pBob[src_pitch2 - 1]) / 2;
diff[1] = ABS (pBob[3] - pBob[src_pitch2 - 1]);
}
// a & f
if (ABS (pBob[0] - pBob[src_pitch2 - 2]) < DiffThres &&
ABS (pBob[-2] - pBob[src_pitch2 + 2]) > DiffThres) {
best[0] = (pBob[-2] + pBob[src_pitch2 + 2]) / 2;
diff[0] = ABS (pBob[-2] - pBob[src_pitch2 + 2]);
}
if (ABS (pBob[1] - pBob[src_pitch2 - 1]) < DiffThres &&
ABS (pBob[-1] - pBob[src_pitch2 + 3]) > DiffThres) {
best[1] = (pBob[-1] + pBob[src_pitch2 + 3]) / 2;
diff[1] = ABS (pBob[-1] - pBob[src_pitch2 + 3]);
}
// b,e
if (ABS (pBob[0] - pBob[src_pitch2]) < DiffThres) {
best[0] = (pBob[0] + pBob[src_pitch2]) / 2;
diff[0] = ABS (pBob[0] - pBob[src_pitch2]);
}
if (ABS (pBob[1] - pBob[src_pitch2 + 1]) < DiffThres) {
best[1] = (pBob[1] + pBob[src_pitch2 + 1]) / 2;
diff[1] = ABS (pBob[1] - pBob[src_pitch2 + 1]);
}
// We will also calc here the max/min values to later limit comb
// so the max excursion will not exceed the Max_Comb constant
#ifdef SKIP_SEARCH
best[0] = CLAMP (best[0], MIN (pBob[src_pitch2], pBob[0]), MAX (pBob[src_pitch2], pBob[0]));
best[1] = CLAMP (best[1], MIN (pBob[src_pitch2 + 1], pBob[1]), MAX (pBob[src_pitch2 + 1], pBob[1]));
#else
mov[0] = MAX (ABS (pBob[0] - pBobP[0]), ABS (pBob[src_pitch2] - pBobP[src_pitch2]));
mov[1] = MAX (ABS (pBob[1] - pBobP[1]), ABS (pBob[src_pitch2 + 1] - pBobP[src_pitch2 + 1]));
MinVals[0] = 0;
MinVals[1] = 0;
MaxVals[0] = 255;
MaxVals[1] = 255;
if (mov[0] > DiffThres) {
MinVals[0] = MAX (MIN (pBob[0], pBob[src_pitch2]), best[0]);
MaxVals[0] = MIN (MAX (pBob[0], pBob[src_pitch2]), best[0]);
}
if (mov[1] > DiffThres) {
MinVals[1] = MAX (MIN (pBob[1], pBob[src_pitch2+1]), best[1]);
MaxVals[1] = MIN (MAX (pBob[1], pBob[src_pitch2+1]), best[1]);
}
best[0] = CLAMP (best[0], MIN (pBob[src_pitch2], pBob[0]), MAX (pBob[src_pitch2], pBob[0]));
best[1] = CLAMP (best[1], MIN (pBob[src_pitch2 + 1], pBob[1]), MAX (pBob[src_pitch2 + 1], pBob[1]));
#endif
avg[0] = (pBob[src_pitch2] + pBob[0]) / 2;
avg[1] = (pBob[src_pitch2 + 1] + pBob[1]) / 2;
diff2[0] = ABS (pBob[src_pitch2 + 1] - pBob[1]);
diff2[1] = ABS (pBob[src_pitch2 + 1] - pBob[1]);
if (diff[0] == -1 || diff2[0] < diff[0]) {
best[0] = avg[0];
diff[0] = diff2[0];
}
if (diff[1] == -1 || diff2[1] < diff[1]) {
best[1] = avg[1];
diff[1] = diff2[1];
}
#endif