static void gst_dtsdec_class_init (GstDtsDecClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; guint cpuflags; gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; gobject_class->set_property = gst_dtsdec_set_property; gobject_class->get_property = gst_dtsdec_get_property; gstelement_class->change_state = gst_dtsdec_change_state; g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DRC, g_param_spec_boolean ("drc", "Dynamic Range Compression", "Use Dynamic Range Compression", FALSE, G_PARAM_READWRITE)); oil_init (); klass->dts_cpuflags = 0; cpuflags = oil_cpu_get_flags (); if (cpuflags & OIL_IMPL_FLAG_MMX) klass->dts_cpuflags |= MM_ACCEL_X86_MMX; if (cpuflags & OIL_IMPL_FLAG_3DNOW) klass->dts_cpuflags |= MM_ACCEL_X86_3DNOW; if (cpuflags & OIL_IMPL_FLAG_MMXEXT) klass->dts_cpuflags |= MM_ACCEL_X86_MMXEXT; GST_LOG ("CPU flags: dts=%08x, liboil=%08x", klass->dts_cpuflags, cpuflags); }
static void oil_print_impl (OilFunctionImpl *impl, OilTest *test, char* prefix) { char *c; unsigned int cpu_flags = oil_cpu_get_flags(); if (oil_impl_is_runnable (impl)) { oil_test_check_impl (test, impl); } printf ("%s%s\n", prefix, impl->name); c = oil_flags_to_string (impl->flags); if (c) { printf ("%s flags: %s\n", prefix, c); free (c); } if (impl->profile_ave) { printf ("%s profile: %g ticks (std.dev. %g)\n", prefix, impl->profile_ave, impl->profile_std); } if (test && !(impl->flags & OIL_IMPL_FLAG_REF)) { printf ("%s sum abs difference: %g (n=%d)\n", prefix, test->sum_abs_diff, test->n_points); } if ((impl->flags & OIL_CPU_FLAG_MASK) & (~cpu_flags)) { printf ("%s disabled\n", prefix); } }
static void gst_deinterlace_method_linear_class_init (GstDeinterlaceMethodLinearClass * klass) { GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass; GstDeinterlaceSimpleMethodClass *dism_class = (GstDeinterlaceSimpleMethodClass *) klass; #ifdef BUILD_X86_ASM guint cpu_flags = oil_cpu_get_flags (); #endif dim_class->fields_required = 1; dim_class->name = "Television: Full resolution"; dim_class->nick = "linear"; dim_class->latency = 0; dism_class->interpolate_scanline = deinterlace_scanline_linear_c; #ifdef BUILD_X86_ASM if (cpu_flags & OIL_IMPL_FLAG_MMXEXT) { dism_class->interpolate_scanline = deinterlace_scanline_linear_mmxext; } else if (cpu_flags & OIL_IMPL_FLAG_MMXEXT) { dism_class->interpolate_scanline = deinterlace_scanline_linear_mmx; } #endif }
static void do_activate_impl (const char *section, char *key, char *value) { unsigned int flags; OilClass *cls; if (section == NULL) { fprintf (stderr, "No section defined, assume no flags need"); flags = 0; } else if (parse_flags_string (section, &flags) == 0) return; cls = oil_class_get (key); if (cls == NULL) fprintf (stderr, "No function class names \"%s\"\n", key); else if ((oil_cpu_get_flags () & flags) == flags) { oil_class_implements_get (cls, value, &flags); if ((oil_cpu_get_flags () & flags) == flags) { char *t; oil_class_activate_implement (cls, value); /* check, whether we'v activated the implement successfully */ t = oil_class_get_active_implement (cls); if (!t || strcmp (t, value) != 0) fprintf (stderr, "Activate %s.%s failed\n", key, value); } else { fprintf (stderr, "Implement %s.%s in section [%s], isn't runnable in current CPU\n", key, value, section); } } }
static void gst_deinterlace_method_tomsmocomp_class_init (GstDeinterlaceMethodTomsMoCompClass * klass) { GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass; GObjectClass *gobject_class = (GObjectClass *) klass; #ifdef BUILD_X86_ASM guint cpu_flags = oil_cpu_get_flags (); #endif gobject_class->set_property = gst_deinterlace_method_tomsmocomp_set_property; gobject_class->get_property = gst_deinterlace_method_tomsmocomp_get_property; g_object_class_install_property (gobject_class, ARG_SEARCH_EFFORT, g_param_spec_uint ("search-effort", "Search Effort", "Search Effort", 0, 27, 5, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) ); g_object_class_install_property (gobject_class, ARG_STRANGE_BOB, g_param_spec_boolean ("strange-bob", "Strange Bob", "Use strange bob", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) ); dim_class->fields_required = 4; dim_class->name = "Motion Adaptive: Motion Search"; dim_class->nick = "tomsmocomp"; dim_class->latency = 1; #ifdef BUILD_X86_ASM if (cpu_flags & OIL_IMPL_FLAG_MMXEXT) { dim_class->deinterlace_frame = tomsmocompDScaler_MMXEXT; } else if (cpu_flags & OIL_IMPL_FLAG_3DNOW) { dim_class->deinterlace_frame = tomsmocompDScaler_3DNOW; } else if (cpu_flags & OIL_IMPL_FLAG_MMX) { dim_class->deinterlace_frame = tomsmocompDScaler_MMX; } else { dim_class->deinterlace_frame = tomsmocompDScaler_C; } #else dim_class->deinterlace_frame = tomsmocompDScaler_C; #endif }
static void gst_deinterlace_method_vfir_class_init (GstDeinterlaceMethodVFIRClass * klass) { GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass; #ifdef BUILD_X86_ASM guint cpu_flags = oil_cpu_get_flags (); #endif dim_class->fields_required = 2; dim_class->deinterlace_frame = deinterlace_frame_vfir; dim_class->name = "Blur Vertical"; dim_class->nick = "vfir"; dim_class->latency = 0; #ifdef BUILD_X86_ASM if (cpu_flags & OIL_IMPL_FLAG_MMX) { klass->scanline = deinterlace_line_mmx; } else { klass->scanline = deinterlace_line_c; } #else klass->scanline = deinterlace_line_c; #endif }
static void gst_deinterlace_method_linear_class_init (GstDeinterlaceMethodLinearClass * klass) { GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass; GstDeinterlaceSimpleMethodClass *dism_class = (GstDeinterlaceSimpleMethodClass *) klass; #ifdef BUILD_X86_ASM guint cpu_flags = oil_cpu_get_flags (); #endif dim_class->fields_required = 1; dim_class->name = "Television: Full resolution"; dim_class->nick = "linear"; dim_class->latency = 0; dism_class->interpolate_scanline_yuy2 = deinterlace_scanline_linear_packed_c; dism_class->interpolate_scanline_yvyu = deinterlace_scanline_linear_packed_c; dism_class->interpolate_scanline_uyvy = deinterlace_scanline_linear_packed_c; dism_class->interpolate_scanline_ayuv = deinterlace_scanline_linear_packed_c; dism_class->interpolate_scanline_argb = deinterlace_scanline_linear_packed_c; dism_class->interpolate_scanline_abgr = deinterlace_scanline_linear_packed_c; dism_class->interpolate_scanline_rgba = deinterlace_scanline_linear_packed_c; dism_class->interpolate_scanline_bgra = deinterlace_scanline_linear_packed_c; dism_class->interpolate_scanline_rgb = deinterlace_scanline_linear_packed_c; dism_class->interpolate_scanline_bgr = deinterlace_scanline_linear_packed_c; dism_class->interpolate_scanline_planar_y = deinterlace_scanline_linear_planar_y_c; dism_class->interpolate_scanline_planar_u = deinterlace_scanline_linear_planar_u_c; dism_class->interpolate_scanline_planar_v = deinterlace_scanline_linear_planar_v_c; #ifdef BUILD_X86_ASM if (cpu_flags & OIL_IMPL_FLAG_MMXEXT) { dism_class->interpolate_scanline_ayuv = deinterlace_scanline_linear_packed_mmxext; dism_class->interpolate_scanline_yuy2 = deinterlace_scanline_linear_packed_mmxext; dism_class->interpolate_scanline_yvyu = deinterlace_scanline_linear_packed_mmxext; dism_class->interpolate_scanline_uyvy = deinterlace_scanline_linear_packed_mmxext; dism_class->interpolate_scanline_argb = deinterlace_scanline_linear_packed_mmxext; dism_class->interpolate_scanline_abgr = deinterlace_scanline_linear_packed_mmxext; dism_class->interpolate_scanline_rgba = deinterlace_scanline_linear_packed_mmxext; dism_class->interpolate_scanline_bgra = deinterlace_scanline_linear_packed_mmxext; dism_class->interpolate_scanline_rgb = deinterlace_scanline_linear_packed_mmxext; dism_class->interpolate_scanline_bgr = deinterlace_scanline_linear_packed_mmxext; dism_class->interpolate_scanline_planar_y = deinterlace_scanline_linear_planar_y_mmxext; dism_class->interpolate_scanline_planar_u = deinterlace_scanline_linear_planar_u_mmxext; dism_class->interpolate_scanline_planar_v = deinterlace_scanline_linear_planar_v_mmxext; } else if (cpu_flags & OIL_IMPL_FLAG_MMX) { dism_class->interpolate_scanline_ayuv = deinterlace_scanline_linear_packed_mmx; dism_class->interpolate_scanline_yuy2 = deinterlace_scanline_linear_packed_mmx; dism_class->interpolate_scanline_yvyu = deinterlace_scanline_linear_packed_mmx; dism_class->interpolate_scanline_uyvy = deinterlace_scanline_linear_packed_mmx; dism_class->interpolate_scanline_argb = deinterlace_scanline_linear_packed_mmx; dism_class->interpolate_scanline_abgr = deinterlace_scanline_linear_packed_mmx; dism_class->interpolate_scanline_rgba = deinterlace_scanline_linear_packed_mmx; dism_class->interpolate_scanline_bgra = deinterlace_scanline_linear_packed_mmx; dism_class->interpolate_scanline_rgb = deinterlace_scanline_linear_packed_mmx; dism_class->interpolate_scanline_bgr = deinterlace_scanline_linear_packed_mmx; dism_class->interpolate_scanline_planar_y = deinterlace_scanline_linear_planar_y_mmx; dism_class->interpolate_scanline_planar_u = deinterlace_scanline_linear_planar_u_mmx; dism_class->interpolate_scanline_planar_v = deinterlace_scanline_linear_planar_v_mmx; } #endif }
int main (int argc, char *argv[]) { OilFunctionClass *klass; OilFunctionImpl *impl; OilTest *test; int i; int n; //int j; int ret; unsigned int cpu_flags; //xmlfile = "test1"; std_log(LOG_FILENAME_LINE, "Test Started testsuite_test1"); oil_init (); cpu_flags = oil_cpu_get_flags (); //Returns a bitmask containing the available CPU features n = oil_class_get_n_classes (); for (i=0;i<n; i++ ){ klass = oil_class_get_by_index(i); printf("%s\n", klass->name); std_log(LOG_FILENAME_LINE, "class name = %s\n",klass->name); test = oil_test_new (klass); //Creates a new OilTest(structure describing how to test an OilFunctionImpl for an OilFunctionClass) for the OilFunctionClass represented by klass if (test == NULL) { std_log(LOG_FILENAME_LINE, "bad prototype"); printf(" bad prototype\n"); continue; } for (impl = klass->first_impl; impl; impl = impl->next) { printf(" %s\n", impl->name); if ((impl->flags & OIL_CPU_FLAG_MASK) & ~cpu_flags) { std_log(LOG_FILENAME_LINE, "not supported"); printf("not supported\n"); } else { test->n = 1600; ret = oil_test_check_impl (test, impl); //Runs the testing procedure described by test on the implementation impl if (ret) { #if 0 printf(" %lu %g\n",test->prof.min, (double)test->prof.total/test->prof.n); for(j=0;j<test->prof.hist_n;j++){ printf(" %lu %d\n",test->prof.hist_time[j],test->prof.hist_count[j]); } #endif printf(" ave=%g std=%g\n", impl->profile_ave, impl->profile_std); //hist(test); } else { printf(" not tested\n"); oil_test_free (test); std_log(LOG_FILENAME_LINE, "Test Failed"); create_xml(1); return 1; } } }//for loop oil_test_free (test); //Frees memory associated with test(OilTest) } std_log(LOG_FILENAME_LINE, "Test Successful"); create_xml(0); return 0; }
void gst_video_mixer_init_blend (void) { guint cpu_flags; oil_init (); cpu_flags = oil_cpu_get_flags (); gst_video_mixer_blend_argb = blend_argb_c; gst_video_mixer_blend_bgra = blend_bgra_c; gst_video_mixer_blend_i420 = blend_i420_c; gst_video_mixer_blend_y444 = blend_y444_c; gst_video_mixer_blend_y42b = blend_y42b_c; gst_video_mixer_blend_y41b = blend_y41b_c; gst_video_mixer_blend_rgb = blend_rgb_c; gst_video_mixer_blend_xrgb = blend_xrgb_c; gst_video_mixer_blend_yuy2 = blend_yuy2_c; gst_video_mixer_fill_checker_argb = fill_checker_argb_c; gst_video_mixer_fill_checker_bgra = fill_checker_bgra_c; gst_video_mixer_fill_checker_ayuv = fill_checker_ayuv_c; gst_video_mixer_fill_checker_i420 = fill_checker_i420_c; gst_video_mixer_fill_checker_y444 = fill_checker_y444_c; gst_video_mixer_fill_checker_y42b = fill_checker_y42b_c; gst_video_mixer_fill_checker_y41b = fill_checker_y41b_c; gst_video_mixer_fill_checker_rgb = fill_checker_rgb_c; gst_video_mixer_fill_checker_xrgb = fill_checker_xrgb_c; gst_video_mixer_fill_checker_yuy2 = fill_checker_yuy2_c; gst_video_mixer_fill_checker_uyvy = fill_checker_uyvy_c; gst_video_mixer_fill_color_argb = fill_color_argb_c; gst_video_mixer_fill_color_bgra = fill_color_bgra_c; gst_video_mixer_fill_color_abgr = fill_color_abgr_c; gst_video_mixer_fill_color_rgba = fill_color_rgba_c; gst_video_mixer_fill_color_ayuv = fill_color_ayuv_c; gst_video_mixer_fill_color_i420 = fill_color_i420_c; gst_video_mixer_fill_color_yv12 = fill_color_yv12_c; gst_video_mixer_fill_color_y444 = fill_color_y444_c; gst_video_mixer_fill_color_y42b = fill_color_y42b_c; gst_video_mixer_fill_color_y41b = fill_color_y41b_c; gst_video_mixer_fill_color_rgb = fill_color_rgb_c; gst_video_mixer_fill_color_bgr = fill_color_bgr_c; gst_video_mixer_fill_color_xrgb = fill_color_xrgb_c; gst_video_mixer_fill_color_xbgr = fill_color_xbgr_c; gst_video_mixer_fill_color_rgbx = fill_color_rgbx_c; gst_video_mixer_fill_color_bgrx = fill_color_bgrx_c; gst_video_mixer_fill_color_yuy2 = fill_color_yuy2_c; gst_video_mixer_fill_color_yvyu = fill_color_yvyu_c; gst_video_mixer_fill_color_uyvy = fill_color_uyvy_c; #ifdef BUILD_X86_ASM if (cpu_flags & OIL_IMPL_FLAG_MMX) { gst_video_mixer_blend_argb = blend_argb_mmx; gst_video_mixer_blend_bgra = blend_bgra_mmx; gst_video_mixer_blend_i420 = blend_i420_mmx; gst_video_mixer_blend_y444 = blend_y444_mmx; gst_video_mixer_blend_y42b = blend_y42b_mmx; gst_video_mixer_blend_y41b = blend_y41b_mmx; gst_video_mixer_blend_rgb = blend_rgb_mmx; gst_video_mixer_blend_xrgb = blend_xrgb_mmx; gst_video_mixer_blend_yuy2 = blend_yuy2_mmx; gst_video_mixer_fill_checker_i420 = fill_checker_i420_mmx; gst_video_mixer_fill_checker_y444 = fill_checker_y444_mmx; gst_video_mixer_fill_checker_y42b = fill_checker_y42b_mmx; gst_video_mixer_fill_checker_y41b = fill_checker_y41b_mmx; gst_video_mixer_fill_color_argb = fill_color_argb_mmx; gst_video_mixer_fill_color_bgra = fill_color_bgra_mmx; gst_video_mixer_fill_color_abgr = fill_color_abgr_mmx; gst_video_mixer_fill_color_rgba = fill_color_rgba_mmx; gst_video_mixer_fill_color_ayuv = fill_color_ayuv_mmx; gst_video_mixer_fill_color_i420 = fill_color_i420_mmx; gst_video_mixer_fill_color_yv12 = fill_color_yv12_mmx; gst_video_mixer_fill_color_y444 = fill_color_y444_mmx; gst_video_mixer_fill_color_y42b = fill_color_y42b_mmx; gst_video_mixer_fill_color_y41b = fill_color_y41b_mmx; gst_video_mixer_fill_color_xrgb = fill_color_xrgb_mmx; gst_video_mixer_fill_color_xbgr = fill_color_xbgr_mmx; gst_video_mixer_fill_color_rgbx = fill_color_rgbx_mmx; gst_video_mixer_fill_color_bgrx = fill_color_bgrx_mmx; } #endif }
int main (int argc, char *argv[]) { OilFunctionClass *klass; OilFunctionImpl *impl; OilTest *test; int i; int n; int j; int ret; unsigned int cpu_flags; //xmlfile = "stride"; std_log(LOG_FILENAME_LINE, "Test Started testsuite_stride"); if (argc > 1 && strcmp(argv[1],"-v") == 0) { verbose = 1; } oil_init (); cpu_flags = oil_cpu_get_flags (); n = oil_class_get_n_classes (); for (i=0;i<n; i++ ) { klass = oil_class_get_by_index(i); std_log(LOG_FILENAME_LINE,"Class Name %s %d\n",klass->name, i); test = oil_test_new (klass); if (test == NULL) { std_log(LOG_FILENAME_LINE,"class \"%s\" has bad prototype\n", klass->name); assert_failed = fail = 1; continue; } oil_test_set_iterations (test, 1); test->n = 1 + oil_rand_u8(); test->m = 1 + oil_rand_u8(); std_log(LOG_FILENAME_LINE, "ref impl %s",klass->reference_impl->name); oil_test_check_impl (test, klass->reference_impl); //Testing whether an appropriate implementation is suitable or not //Runs the testing procedure described by test on the implementation impl for(j=0;j<OIL_ARG_LAST;j++) { if (test->params[j].is_stride) { test->params[j].value += oil_type_sizeof(test->params[j].type) * (oil_rand_u8()&0xf); } } test->inited = 0; for (impl = klass->first_impl; impl; impl = impl->next) { std_log(LOG_FILENAME_LINE," %s\n", impl->name); if ((impl->flags & OIL_CPU_FLAG_MASK) & ~cpu_flags){ std_log(LOG_FILENAME_LINE, "Not supported"); } else { ret = oil_test_check_impl (test, impl); if (!ret) { assert_failed = fail = 1; oil_test_free (test); std_log(LOG_FILENAME_LINE, "Test Failed"); create_xml(1); return fail; } } } oil_test_free (test); } if(assert_failed) std_log(LOG_FILENAME_LINE,"Test Fail"); else std_log(LOG_FILENAME_LINE,"Test Successful"); create_xml(0); return fail; }
static void gst_a52dec_class_init (GstA52DecClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; guint cpuflags; gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; gobject_class->set_property = gst_a52dec_set_property; gobject_class->get_property = gst_a52dec_get_property; gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_a52dec_change_state); /** * GstA52Dec::drc * * Set to true to apply the recommended Dolby Digital dynamic range compression * to the audio stream. Dynamic range compression makes loud sounds * softer and soft sounds louder, so you can more easily listen * to the stream without disturbing other people. */ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DRC, g_param_spec_boolean ("drc", "Dynamic Range Compression", "Use Dynamic Range Compression", FALSE, G_PARAM_READWRITE)); /** * GstA52Dec::mode * * Force a particular output channel configuration from the decoder. By default, * the channel downmix (if any) is chosen automatically based on the downstream * capabilities of the pipeline. */ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MODE, g_param_spec_enum ("mode", "Decoder Mode", "Decoding Mode (default 3f2r)", GST_TYPE_A52DEC_MODE, A52_3F2R, G_PARAM_READWRITE)); /** * GstA52Dec::lfe * * Whether to output the LFE (Low Frequency Emitter) channel of the audio stream. */ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LFE, g_param_spec_boolean ("lfe", "LFE", "LFE", TRUE, G_PARAM_READWRITE)); oil_init (); /* If no CPU instruction based acceleration is available, end up using the * generic software djbfft based one when available in the used liba52 */ #ifdef MM_ACCEL_DJBFFT klass->a52_cpuflags = MM_ACCEL_DJBFFT; #else klass->a52_cpuflags = 0; #endif cpuflags = oil_cpu_get_flags (); if (cpuflags & OIL_IMPL_FLAG_MMX) klass->a52_cpuflags |= MM_ACCEL_X86_MMX; if (cpuflags & OIL_IMPL_FLAG_3DNOW) klass->a52_cpuflags |= MM_ACCEL_X86_3DNOW; if (cpuflags & OIL_IMPL_FLAG_MMXEXT) klass->a52_cpuflags |= MM_ACCEL_X86_MMXEXT; GST_LOG ("CPU flags: a52=%08x, liboil=%08x", klass->a52_cpuflags, cpuflags); }