| 1 | /* scale0tilt.c |
| 2 | * Copyright (C) 2007 Richard Spindler ([email protected]) |
| 3 | * This file is a Frei0r plugin. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 | */ |
| 19 | |
| 20 | #include <math.h> |
| 21 | #include "frei0r.h"cxx . . $ `<file>/include/frei0r.h`/ |
| 22 | #include <gavl/gavl.h> |
| 23 | #include <stdlib.h> |
| 24 | #include <string.h> |
| 25 | |
| 26 | #define EPSILONcxx . . $ `src/filter/scale0tilt/scale0tilt.c:26:9`! 1e-6 |
| 27 | |
| 28 | typedef struct scale0tilt_instancecxx . . $ scale0tilt_instance# { |
| 29 | double clcxx . . $ scale0tilt_instance#cl., ctcxx . . $ scale0tilt_instance#ct., crcxx . . $ scale0tilt_instance#cr., cbcxx . . $ scale0tilt_instance#cb.; |
| 30 | double sxcxx . . $ scale0tilt_instance#sx., sycxx . . $ scale0tilt_instance#sy.; |
| 31 | double txcxx . . $ scale0tilt_instance#tx., tycxx . . $ scale0tilt_instance#ty.; |
| 32 | int wcxx . . $ scale0tilt_instance#w., hcxx . . $ scale0tilt_instance#h.; |
| 33 | gavl_video_scaler_tcxx . . $ gavl_video_scaler_t#* video_scalercxx . . $ scale0tilt_instance#video_scaler.; |
| 34 | gavl_video_frame_tcxx . . $ gavl_video_frame_t#* frame_srccxx . . $ scale0tilt_instance#frame_src.; |
| 35 | gavl_video_frame_tcxx . . $ gavl_video_frame_t#* frame_dstcxx . . $ scale0tilt_instance#frame_dst.; |
| 36 | int do_scalecxx . . $ scale0tilt_instance#do_scale.; |
| 37 | gavl_video_format_tcxx . . $ gavl_video_format_t# format_srccxx . . $ scale0tilt_instance#format_src.; |
| 38 | gavl_video_frame_tcxx . . $ gavl_video_frame_t#* paddedcxx . . $ scale0tilt_instance#padded.; |
| 39 | } scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#; |
| 40 | |
| 41 | void update_scalercxx . . $ update_scaler(e655daaa5c1a4809).( scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#* inst ) |
| 42 | { |
| 43 | float dst_x, dst_y, dst_w, dst_h; |
| 44 | float src_x, src_y, src_w, src_h; |
| 45 | |
| 46 | inst->do_scalecxx . . $ scale0tilt_instance#do_scale. = 1; |
| 47 | src_x = inst->wcxx . . $ scale0tilt_instance#w. * inst->clcxx . . $ scale0tilt_instance#cl.; |
| 48 | src_y = inst->hcxx . . $ scale0tilt_instance#h. * inst->ctcxx . . $ scale0tilt_instance#ct.; |
| 49 | src_w = inst->wcxx . . $ scale0tilt_instance#w. * (1.0 - inst->clcxx . . $ scale0tilt_instance#cl. - inst->crcxx . . $ scale0tilt_instance#cr. ); |
| 50 | src_h = inst->hcxx . . $ scale0tilt_instance#h. * (1.0 - inst->ctcxx . . $ scale0tilt_instance#ct. - inst->cbcxx . . $ scale0tilt_instance#cb. ); |
| 51 | |
| 52 | dst_x = inst->wcxx . . $ scale0tilt_instance#w. * inst->clcxx . . $ scale0tilt_instance#cl. * inst->sxcxx . . $ scale0tilt_instance#sx. + inst->txcxx . . $ scale0tilt_instance#tx. * inst->wcxx . . $ scale0tilt_instance#w.; |
| 53 | dst_y = inst->hcxx . . $ scale0tilt_instance#h. * inst->ctcxx . . $ scale0tilt_instance#ct. * inst->sycxx . . $ scale0tilt_instance#sy. + inst->tycxx . . $ scale0tilt_instance#ty. * inst->hcxx . . $ scale0tilt_instance#h.; |
| 54 | dst_w = inst->wcxx . . $ scale0tilt_instance#w. * (1.0 - inst->clcxx . . $ scale0tilt_instance#cl. - inst->crcxx . . $ scale0tilt_instance#cr.) * inst->sxcxx . . $ scale0tilt_instance#sx.; |
| 55 | dst_h = inst->hcxx . . $ scale0tilt_instance#h. * (1.0 - inst->ctcxx . . $ scale0tilt_instance#ct. - inst->cbcxx . . $ scale0tilt_instance#cb.) * inst->sycxx . . $ scale0tilt_instance#sy.; |
| 56 | |
| 57 | if((dst_w < EPSILONcxx . . $ `src/filter/scale0tilt/scale0tilt.c:26:9`!) || (dst_h < EPSILONcxx . . $ `src/filter/scale0tilt/scale0tilt.c:26:9`!) || |
| 58 | (src_w < EPSILONcxx . . $ `src/filter/scale0tilt/scale0tilt.c:26:9`!) || (src_h < EPSILONcxx . . $ `src/filter/scale0tilt/scale0tilt.c:26:9`!)) { |
| 59 | inst->do_scalecxx . . $ scale0tilt_instance#do_scale. = 0; |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | if ( dst_x + dst_w > inst->wcxx . . $ scale0tilt_instance#w. ) { |
| 64 | src_w = src_w * ( (inst->wcxx . . $ scale0tilt_instance#w.-dst_x) / dst_w ); |
| 65 | dst_w = inst->wcxx . . $ scale0tilt_instance#w. - dst_x; |
| 66 | } |
| 67 | if ( dst_y + dst_h > inst->hcxx . . $ scale0tilt_instance#h. ) { |
| 68 | src_h = src_h * ( (inst->hcxx . . $ scale0tilt_instance#h.-dst_y) / dst_h ); |
| 69 | dst_h = inst->hcxx . . $ scale0tilt_instance#h. - dst_y; |
| 70 | } |
| 71 | if ( dst_x < 0 ) { |
| 72 | src_x = src_x - dst_x * ( src_w / dst_w ); |
| 73 | src_w = src_w * ( (dst_w+dst_x) / dst_w ); |
| 74 | dst_w = dst_w + dst_x; |
| 75 | dst_x = 0; |
| 76 | } |
| 77 | if ( dst_y < 0 ) { |
| 78 | src_y = src_y - dst_y * ( src_h / dst_h ); |
| 79 | src_h = src_h * ( (dst_h+dst_y) / dst_h ); |
| 80 | dst_h = dst_h + dst_y; |
| 81 | dst_y = 0; |
| 82 | } |
| 83 | |
| 84 | if((dst_w < EPSILONcxx . . $ `src/filter/scale0tilt/scale0tilt.c:26:9`!) || (dst_h < EPSILONcxx . . $ `src/filter/scale0tilt/scale0tilt.c:26:9`!) || |
| 85 | (src_w < EPSILONcxx . . $ `src/filter/scale0tilt/scale0tilt.c:26:9`!) || (src_h < EPSILONcxx . . $ `src/filter/scale0tilt/scale0tilt.c:26:9`!)) { |
| 86 | inst->do_scalecxx . . $ scale0tilt_instance#do_scale. = 0; |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | gavl_video_options_tcxx . . $ gavl_video_options_t#* options = gavl_video_scaler_get_optionscxx . . $ gavl_video_scaler_get_options(b9bbd2b735e294e4).( inst->video_scalercxx . . $ scale0tilt_instance#video_scaler. ); |
| 91 | |
| 92 | gavl_video_format_tcxx . . $ gavl_video_format_t# format_dst; |
| 93 | |
| 94 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&inst->format_srccxx . . $ scale0tilt_instance#format_src., 0, sizeof(inst->format_srccxx . . $ scale0tilt_instance#format_src.)); |
| 95 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&format_dst, 0, sizeof(format_dst)); |
| 96 | |
| 97 | format_dst.frame_widthcxx . . $ gavl_video_format_s#frame_width. = inst->wcxx . . $ scale0tilt_instance#w.; |
| 98 | format_dst.frame_heightcxx . . $ gavl_video_format_s#frame_height. = inst->hcxx . . $ scale0tilt_instance#h.; |
| 99 | format_dst.image_widthcxx . . $ gavl_video_format_s#image_width. = inst->wcxx . . $ scale0tilt_instance#w.; |
| 100 | format_dst.image_heightcxx . . $ gavl_video_format_s#image_height. = inst->hcxx . . $ scale0tilt_instance#h.; |
| 101 | format_dst.pixel_widthcxx . . $ gavl_video_format_s#pixel_width. = 1; |
| 102 | format_dst.pixel_heightcxx . . $ gavl_video_format_s#pixel_height. = 1; |
| 103 | format_dst.pixelformatcxx . . $ gavl_video_format_s#pixelformat. = GAVL_RGBA_32cxx . . $ GAVL_RGBA_32.; |
| 104 | |
| 105 | inst->format_srccxx . . $ scale0tilt_instance#format_src..frame_widthcxx . . $ gavl_video_format_s#frame_width. = inst->wcxx . . $ scale0tilt_instance#w.; |
| 106 | inst->format_srccxx . . $ scale0tilt_instance#format_src..frame_heightcxx . . $ gavl_video_format_s#frame_height. = inst->hcxx . . $ scale0tilt_instance#h.; |
| 107 | inst->format_srccxx . . $ scale0tilt_instance#format_src..image_widthcxx . . $ gavl_video_format_s#image_width. = inst->wcxx . . $ scale0tilt_instance#w.; |
| 108 | inst->format_srccxx . . $ scale0tilt_instance#format_src..image_heightcxx . . $ gavl_video_format_s#image_height. = inst->hcxx . . $ scale0tilt_instance#h.; |
| 109 | inst->format_srccxx . . $ scale0tilt_instance#format_src..pixel_widthcxx . . $ gavl_video_format_s#pixel_width. = 1; |
| 110 | inst->format_srccxx . . $ scale0tilt_instance#format_src..pixel_heightcxx . . $ gavl_video_format_s#pixel_height. = 1; |
| 111 | inst->format_srccxx . . $ scale0tilt_instance#format_src..pixelformatcxx . . $ gavl_video_format_s#pixelformat. = GAVL_RGBA_32cxx . . $ GAVL_RGBA_32.; |
| 112 | |
| 113 | gavl_rectangle_f_tcxx . . $ gavl_rectangle_f_t# src_rect; |
| 114 | gavl_rectangle_i_tcxx . . $ gavl_rectangle_i_t# dst_rect; |
| 115 | |
| 116 | src_rect.xcxx . . $ $anonymous_type_8cc768623503e55e_10#x. = src_x; |
| 117 | src_rect.ycxx . . $ $anonymous_type_8cc768623503e55e_10#y. = src_y; |
| 118 | src_rect.wcxx . . $ $anonymous_type_8cc768623503e55e_10#w. = src_w; |
| 119 | src_rect.hcxx . . $ $anonymous_type_8cc768623503e55e_10#h. = src_h; |
| 120 | |
| 121 | dst_rect.xcxx . . $ $anonymous_type_8cc768623503e55e_9#x. = lroundfcxx . . $ lroundf(2b53f6384d78b03a).(dst_x); |
| 122 | dst_rect.ycxx . . $ $anonymous_type_8cc768623503e55e_9#y. = lroundfcxx . . $ lroundf(2b53f6384d78b03a).(dst_y); |
| 123 | dst_rect.wcxx . . $ $anonymous_type_8cc768623503e55e_9#w. = lroundfcxx . . $ lroundf(2b53f6384d78b03a).(dst_w); |
| 124 | dst_rect.hcxx . . $ $anonymous_type_8cc768623503e55e_9#h. = lroundfcxx . . $ lroundf(2b53f6384d78b03a).(dst_h); |
| 125 | |
| 126 | gavl_video_options_set_rectanglescxx . . $ gavl_video_options_set_rectangles(8b559814f3c176fc).( options, &src_rect, &dst_rect ); |
| 127 | gavl_video_scaler_initcxx . . $ gavl_video_scaler_init(ba77d2513b499624).( inst->video_scalercxx . . $ scale0tilt_instance#video_scaler., &inst->format_srccxx . . $ scale0tilt_instance#format_src., &format_dst ); |
| 128 | } |
| 129 | |
| 130 | int f0r_initcxx . . $ f0r_init(b126dc7c1de90089).() |
| 131 | { |
| 132 | return 1; |
| 133 | } |
| 134 | void f0r_deinitcxx . . $ f0r_deinit(49f6e7a06ebc5aa8).() |
| 135 | { /* empty */ } |
| 136 | |
| 137 | void f0r_get_plugin_infocxx . . $ f0r_get_plugin_info(35d753456c0ea59c).( f0r_plugin_info_tcxx . . $ f0r_plugin_info_t#* info ) |
| 138 | { |
| 139 | info->namecxx . . $ f0r_plugin_info#name. = "Scale0Tilt"; |
| 140 | info->authorcxx . . $ f0r_plugin_info#author. = "Richard Spindler"; |
| 141 | info->plugin_typecxx . . $ f0r_plugin_info#plugin_type. = F0R_PLUGIN_TYPE_FILTERcxx . . $ `include/frei0r.h:247:9`!; |
| 142 | info->color_modelcxx . . $ f0r_plugin_info#color_model. = F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!; |
| 143 | info->frei0r_versioncxx . . $ f0r_plugin_info#frei0r_version. = FREI0R_MAJOR_VERSIONcxx . . $ `include/frei0r.h:217:9`!; |
| 144 | info->major_versioncxx . . $ f0r_plugin_info#major_version. = 0; |
| 145 | info->minor_versioncxx . . $ f0r_plugin_info#minor_version. = 1; |
| 146 | info->num_paramscxx . . $ f0r_plugin_info#num_params. = 8; |
| 147 | info->explanationcxx . . $ f0r_plugin_info#explanation. = "Scales, Tilts and Crops an Image"; |
| 148 | |
| 149 | } |
| 150 | void f0r_get_param_infocxx . . $ f0r_get_param_info(a9f9aa7954cc4a37).( f0r_param_info_tcxx . . $ f0r_param_info_t#* info, int param_index ) |
| 151 | { |
| 152 | switch ( param_index ) { |
| 153 | case 0: |
| 154 | info->namecxx . . $ f0r_param_info#name. = "Clip left"; |
| 155 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 156 | info->explanationcxx . . $ f0r_param_info#explanation. = ""; |
| 157 | break; |
| 158 | case 1: |
| 159 | info->namecxx . . $ f0r_param_info#name. = "Clip right"; |
| 160 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 161 | info->explanationcxx . . $ f0r_param_info#explanation. = ""; |
| 162 | break; |
| 163 | case 2: |
| 164 | info->namecxx . . $ f0r_param_info#name. = "Clip top"; |
| 165 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 166 | info->explanationcxx . . $ f0r_param_info#explanation. = ""; |
| 167 | break; |
| 168 | case 3: |
| 169 | info->namecxx . . $ f0r_param_info#name. = "Clip bottom"; |
| 170 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 171 | info->explanationcxx . . $ f0r_param_info#explanation. = ""; |
| 172 | break; |
| 173 | case 4: |
| 174 | info->namecxx . . $ f0r_param_info#name. = "Scale X"; |
| 175 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 176 | info->explanationcxx . . $ f0r_param_info#explanation. = ""; |
| 177 | break; |
| 178 | case 5: |
| 179 | info->namecxx . . $ f0r_param_info#name. = "Scale Y"; |
| 180 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 181 | info->explanationcxx . . $ f0r_param_info#explanation. = ""; |
| 182 | break; |
| 183 | case 6: |
| 184 | info->namecxx . . $ f0r_param_info#name. = "Tilt X"; |
| 185 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 186 | info->explanationcxx . . $ f0r_param_info#explanation. = ""; |
| 187 | break; |
| 188 | case 7: |
| 189 | info->namecxx . . $ f0r_param_info#name. = "Tilt Y"; |
| 190 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 191 | info->explanationcxx . . $ f0r_param_info#explanation. = ""; |
| 192 | break; |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | f0r_instance_tcxx . . $ f0r_instance_t# f0r_constructcxx . . $ f0r_construct(da3f471cd007a696).(unsigned int width, unsigned int height) |
| 197 | { |
| 198 | scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#* inst = (scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(*inst)); |
| 199 | inst->wcxx . . $ scale0tilt_instance#w. = width; |
| 200 | inst->hcxx . . $ scale0tilt_instance#h. = height; |
| 201 | inst->sxcxx . . $ scale0tilt_instance#sx. = 1.0; |
| 202 | inst->sycxx . . $ scale0tilt_instance#sy. = 1.0; |
| 203 | inst->video_scalercxx . . $ scale0tilt_instance#video_scaler. = gavl_video_scaler_createcxx . . $ gavl_video_scaler_create(1a2fd0aac0fe9d36).(); |
| 204 | inst->frame_srccxx . . $ scale0tilt_instance#frame_src. = gavl_video_frame_createcxx . . $ gavl_video_frame_create(f47336eb4c9a84eb).( 0 ); |
| 205 | inst->frame_dstcxx . . $ scale0tilt_instance#frame_dst. = gavl_video_frame_createcxx . . $ gavl_video_frame_create(f47336eb4c9a84eb).( 0 ); |
| 206 | inst->frame_srccxx . . $ scale0tilt_instance#frame_src.->stridescxx . . $ gavl_video_frame_s#strides.[0] = width * 4; |
| 207 | inst->frame_dstcxx . . $ scale0tilt_instance#frame_dst.->stridescxx . . $ gavl_video_frame_s#strides.[0] = width * 4; |
| 208 | update_scalercxx . . $ update_scaler(e655daaa5c1a4809).(inst); |
| 209 | if ( inst->frame_srccxx . . $ scale0tilt_instance#frame_src.->stridescxx . . $ gavl_video_frame_s#strides.[0] % 16 ) |
| 210 | inst->paddedcxx . . $ scale0tilt_instance#padded. = gavl_video_frame_createcxx . . $ gavl_video_frame_create(f47336eb4c9a84eb).( &inst->format_srccxx . . $ scale0tilt_instance#format_src. ); |
| 211 | return (f0r_instance_tcxx . . $ f0r_instance_t#)inst; |
| 212 | } |
| 213 | void f0r_destructcxx . . $ f0r_destruct(5d22bdacc48458e8).(f0r_instance_tcxx . . $ f0r_instance_t# instance) |
| 214 | { |
| 215 | scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#* inst = (scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#*)instance; |
| 216 | gavl_video_scaler_destroycxx . . $ gavl_video_scaler_destroy(78d32ba0938030).(inst->video_scalercxx . . $ scale0tilt_instance#video_scaler.); |
| 217 | gavl_video_frame_nullcxx . . $ gavl_video_frame_null(78be11d323ae4847).( inst->frame_srccxx . . $ scale0tilt_instance#frame_src. ); |
| 218 | gavl_video_frame_destroycxx . . $ gavl_video_frame_destroy(78be11d323ae4847).( inst->frame_srccxx . . $ scale0tilt_instance#frame_src. ); |
| 219 | gavl_video_frame_nullcxx . . $ gavl_video_frame_null(78be11d323ae4847).( inst->frame_dstcxx . . $ scale0tilt_instance#frame_dst. ); |
| 220 | gavl_video_frame_destroycxx . . $ gavl_video_frame_destroy(78be11d323ae4847).( inst->frame_dstcxx . . $ scale0tilt_instance#frame_dst. ); |
| 221 | if ( inst->paddedcxx . . $ scale0tilt_instance#padded. ) |
| 222 | gavl_video_frame_destroycxx . . $ gavl_video_frame_destroy(78be11d323ae4847).( inst->paddedcxx . . $ scale0tilt_instance#padded. ); |
| 223 | freecxx . . $ free(5d22bdacc48458e8).(instance); |
| 224 | } |
| 225 | void f0r_set_param_valuecxx . . $ f0r_set_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, |
| 226 | f0r_param_tcxx . . $ f0r_param_t# param, int param_index) |
| 227 | { |
| 228 | scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#* inst = (scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#*)instance; |
| 229 | switch ( param_index ) { |
| 230 | case 0: |
| 231 | inst->clcxx . . $ scale0tilt_instance#cl. = *((double*)param); |
| 232 | break; |
| 233 | case 1: |
| 234 | inst->crcxx . . $ scale0tilt_instance#cr. = *((double*)param); |
| 235 | break; |
| 236 | case 2: |
| 237 | inst->ctcxx . . $ scale0tilt_instance#ct. = *((double*)param); |
| 238 | break; |
| 239 | case 3: |
| 240 | inst->cbcxx . . $ scale0tilt_instance#cb. = *((double*)param); |
| 241 | break; |
| 242 | case 4: |
| 243 | inst->sxcxx . . $ scale0tilt_instance#sx. = *((double*)param) * 2.0; |
| 244 | break; |
| 245 | case 5: |
| 246 | inst->sycxx . . $ scale0tilt_instance#sy. = *((double*)param) * 2.0; |
| 247 | break; |
| 248 | case 6: |
| 249 | inst->txcxx . . $ scale0tilt_instance#tx. = *((double*)param) * 2.0 - 1.0; |
| 250 | break; |
| 251 | case 7: |
| 252 | inst->tycxx . . $ scale0tilt_instance#ty. = *((double*)param) * 2.0 - 1.0; |
| 253 | break; |
| 254 | } |
| 255 | update_scalercxx . . $ update_scaler(e655daaa5c1a4809).( inst ); |
| 256 | } |
| 257 | void f0r_get_param_valuecxx . . $ f0r_get_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, |
| 258 | f0r_param_tcxx . . $ f0r_param_t# param, int param_index) |
| 259 | { |
| 260 | scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#* inst = (scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#*)instance; |
| 261 | switch ( param_index ) { |
| 262 | case 0: |
| 263 | *((double*)param) = inst->clcxx . . $ scale0tilt_instance#cl.; |
| 264 | break; |
| 265 | case 1: |
| 266 | *((double*)param) = inst->crcxx . . $ scale0tilt_instance#cr.; |
| 267 | break; |
| 268 | case 2: |
| 269 | *((double*)param) = inst->ctcxx . . $ scale0tilt_instance#ct.; |
| 270 | break; |
| 271 | case 3: |
| 272 | *((double*)param) = inst->cbcxx . . $ scale0tilt_instance#cb.; |
| 273 | break; |
| 274 | case 4: |
| 275 | *((double*)param) = inst->sxcxx . . $ scale0tilt_instance#sx. / 2.0; |
| 276 | break; |
| 277 | case 5: |
| 278 | *((double*)param) = inst->sycxx . . $ scale0tilt_instance#sy. / 2.0; |
| 279 | break; |
| 280 | case 6: |
| 281 | *((double*)param) = (inst->txcxx . . $ scale0tilt_instance#tx. + 1.0) / 2.0; |
| 282 | break; |
| 283 | case 7: |
| 284 | *((double*)param) = (inst->tycxx . . $ scale0tilt_instance#ty. + 1.0) / 2.0; |
| 285 | break; |
| 286 | } |
| 287 | } |
| 288 | void f0r_updatecxx . . $ f0r_update(96cd7b27f2fca8a7).(f0r_instance_tcxx . . $ f0r_instance_t# instance, double time, |
| 289 | const uint32_tcxx . . $ uint32_t#* inframe, uint32_tcxx . . $ uint32_t#* outframe) |
| 290 | { |
| 291 | scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#* inst = (scale0tilt_instance_tcxx . . $ scale0tilt_instance_t#*)instance; |
| 292 | gavl_video_frame_tcxx . . $ gavl_video_frame_t#* frame_src = inst->frame_srccxx . . $ scale0tilt_instance#frame_src.; |
| 293 | inst->frame_srccxx . . $ scale0tilt_instance#frame_src.->planescxx . . $ gavl_video_frame_s#planes.[0] = (uint8_tcxx . . $ uint8_t# *)inframe; |
| 294 | inst->frame_dstcxx . . $ scale0tilt_instance#frame_dst.->planescxx . . $ gavl_video_frame_s#planes.[0] = (uint8_tcxx . . $ uint8_t# *)outframe; |
| 295 | int len = inst->wcxx . . $ scale0tilt_instance#w. * inst->hcxx . . $ scale0tilt_instance#h.; |
| 296 | int i; |
| 297 | for ( i = 0; i < len; i++ ) { |
| 298 | outframe[i] = 0; |
| 299 | } |
| 300 | if ( inst->do_scalecxx . . $ scale0tilt_instance#do_scale. ) { |
| 301 | if ( inst->paddedcxx . . $ scale0tilt_instance#padded. ) { |
| 302 | gavl_video_frame_copycxx . . $ gavl_video_frame_copy(aed4deedcc3a242e).( &inst->format_srccxx . . $ scale0tilt_instance#format_src., inst->paddedcxx . . $ scale0tilt_instance#padded., frame_src ); |
| 303 | frame_src = inst->paddedcxx . . $ scale0tilt_instance#padded.; |
| 304 | } |
| 305 | gavl_video_scaler_scalecxx . . $ gavl_video_scaler_scale(271c0dec308b68ee).( inst->video_scalercxx . . $ scale0tilt_instance#video_scaler., frame_src, inst->frame_dstcxx . . $ scale0tilt_instance#frame_dst. ); |
| 306 | } |
| 307 | } |
| 308 |