Changes of Revision 189

_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/doc/libvlc/gtk_player.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/doc/libvlc/gtk_player.c Changed
x
 
1
@@ -1,4 +1,4 @@
2
-// gcc -o gtk_player gtk_player.c `pkg-config --libs gtk+-2.0 libvlc` `pkg-config --cflags gtk+-2.0 libvlc`
3
+// gcc -o gtk_player gtk_player.c `pkg-config --libs gtk+-3.0 libvlc` `pkg-config --cflags gtk+-3.0 libvlc`
4
 
5
 /* License WTFPL http://sam.zoy.org/wtfpl/ */
6
 /* Written by Vincent Schüßler */
7
@@ -105,7 +105,7 @@
8
     filemenu_openitem = gtk_menu_item_new_with_label("Open");
9
     gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), filemenu_openitem);
10
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(fileitem), filemenu);
11
-    gtk_menu_bar_append(GTK_MENU_BAR(menubar), fileitem);
12
+    gtk_menu_shell_append(GTK_MENU_BAR(menubar), fileitem);
13
     gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
14
     g_signal_connect(filemenu_openitem, "activate", G_CALLBACK(on_open), window);
15
 
16
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/codec/gstreamer/gstdecode.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/codec/gstreamer/gstdecode.c Changed
11
 
1
@@ -380,6 +380,9 @@
2
     case VLC_CODEC_VP9:
3
         p_str = gst_structure_new_empty( "video/x-vp9" );
4
         break;
5
+    case VLC_CODEC_AV1:
6
+        p_str = gst_structure_new_empty( "video/x-av1" );
7
+        break;
8
     case VLC_CODEC_MPGV:
9
         p_str = gst_structure_new_empty( "video/mpeg" );
10
         gst_structure_set( p_str, "mpegversion", G_TYPE_INT, 2,
11
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/codec/hxxx_helper_testdec.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/codec/hxxx_helper_testdec.c Changed
8
 
1
@@ -154,5 +154,6 @@
2
     add_shortcut("hxxxhelper")
3
     set_capability("video decoder", 0)
4
     add_bool("hxxx-helper-testdec-xvcC", false, NULL, NULL)
5
+        change_volatile()
6
     set_callbacks(OpenDecoder, CloseDecoder)
7
 vlc_module_end()
8
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/codec/jpeg.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/codec/jpeg.c Changed
23
 
1
@@ -691,6 +691,21 @@
2
 
3
     jpeg_start_compress(&p_sys->p_jpeg, TRUE);
4
 
5
+    unsigned char exif[] = "Exif\x00\x00"
6
+                           "\x4d\x4d\x00\x2a" /* TIFF BE header */
7
+                           "\x00\x00\x00\x08" /* IFD0 offset */
8
+                           "\x00\x01" /* IFD0 tags count */
9
+                           "\x01\x12" /* tagtype */
10
+                           "\x00\x03" /* value type (x03 == short) */
11
+                           "\x00\x00\x00\x01" /* value count */
12
+                           "\xFF\xFF\x00\x00" /* value if <= 4 bytes or value offset */
13
+                           "\x00\x00\x00\x00" /* 0 last IFD */
14
+                           "\x00\x00\x00\x00" /* 0 last IFD offset */
15
+            ;
16
+    exif[24] = 0x00;
17
+    exif[25] = ORIENT_TO_EXIF(p_pic->format.orientation);
18
+    jpeg_write_marker(&p_sys->p_jpeg, JPEG_APP0 + 1, exif, sizeof(exif) - 1);
19
+
20
     /* Encode picture */
21
     p_row_pointers = vlc_alloc(p_pic->i_planes, sizeof(JSAMPARRAY));
22
     if (p_row_pointers == NULL)
23
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/codec/mft.cpp -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/codec/mft.cpp Changed
201
 
1
@@ -74,10 +74,16 @@
2
 
3
 typedef HRESULT (WINAPI *pf_MFCreateDXGIDeviceManager)(UINT *, IMFDXGIDeviceManager **);
4
 
5
-struct decoder_sys_t
6
+class mft_dec_sys_t
7
 {
8
+public:
9
     ComPtr<IMFTransform> mft;
10
 
11
+    ~mft_dec_sys_t()
12
+    {
13
+        assert(!streamStarted);
14
+    }
15
+
16
     const GUID* major_type = nullptr;
17
     const GUID* subtype = nullptr;
18
     /* Container for a dynamically constructed subtype */
19
@@ -85,10 +91,10 @@
20
 
21
     // Direct3D
22
     vlc_video_context  *vctx_out = nullptr;
23
-    HRESULT (WINAPI *fptr_MFCreateDXGIDeviceManager)(UINT *resetToken, IMFDXGIDeviceManager **ppDeviceManager);
24
+    HRESULT (WINAPI *fptr_MFCreateDXGIDeviceManager)(UINT *resetToken, IMFDXGIDeviceManager **ppDeviceManager) = nullptr;
25
     UINT dxgi_token = 0;
26
     ComPtr<IMFDXGIDeviceManager> dxgi_manager;
27
-    HANDLE d3d_handle = 0;
28
+    HANDLE d3d_handle = INVALID_HANDLE_VALUE;
29
 
30
     // D3D11
31
     ComPtr<ID3D11Texture2D> cached_tex;
32
@@ -130,18 +136,48 @@
33
         return false;
34
     }
35
 
36
-    void DoRelease()
37
+    /// Required for Async MFTs
38
+    HRESULT startStream()
39
+    {
40
+        assert(!streamStarted);
41
+        HRESULT hr = mft->ProcessMessage(MFT_MESSAGE_NOTIFY_START_OF_STREAM, (ULONG_PTR)0);
42
+        if (SUCCEEDED(hr))
43
+            streamStarted = true;
44
+        return hr;
45
+    }
46
+    /// Used for Async MFTs
47
+    HRESULT endStream()
48
     {
49
-        mft->SetInputType(input_stream_id, nullptr, 0);
50
-        mft->SetOutputType(output_stream_id, nullptr, 0);
51
+        assert(streamStarted);
52
+        HRESULT hr = mft->ProcessMessage(MFT_MESSAGE_NOTIFY_END_OF_STREAM, (ULONG_PTR)0);
53
+        if (SUCCEEDED(hr))
54
+            streamStarted = false;
55
+        return hr;
56
+    }
57
+
58
+    HRESULT flushStream()
59
+    {
60
+        HRESULT hr = mft->ProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, 0);
61
+        if (SUCCEEDED(hr))
62
+            streamStarted = false;
63
+        return hr;
64
+    }
65
+
66
+private:
67
 
68
+    void DoRelease()
69
+    {
70
         if (output_sample.Get())
71
             output_sample->RemoveAllBuffers();
72
 
73
-        if (vctx_out)
74
-            mft->ProcessMessage(MFT_MESSAGE_SET_D3D_MANAGER, (ULONG_PTR)0);
75
+        if (mft.Get())
76
+        {
77
+            // mft->SetInputType(input_stream_id, nullptr, 0);
78
+            // mft->SetOutputType(output_stream_id, nullptr, 0);
79
 
80
-        endStreaming();
81
+            if (vctx_out)
82
+                mft->ProcessMessage(MFT_MESSAGE_SET_D3D_MANAGER, (ULONG_PTR)0);
83
+        }
84
 
85
         for (size_t i=0; i < ARRAY_SIZE(cachedSRV); i++)
86
         {
87
@@ -154,7 +190,7 @@
88
 
89
         if (vctx_out && dxgi_manager.Get())
90
         {
91
-            if (d3d_handle)
92
+            if (d3d_handle != INVALID_HANDLE_VALUE)
93
                 dxgi_manager->CloseDeviceHandle(d3d_handle);
94
         }
95
 
96
@@ -166,54 +202,14 @@
97
         MFShutdown();
98
     }
99
 
100
-    bool isStreaming = false;
101
-    HRESULT beginStreaming()
102
-    {
103
-        assert(!isStreaming);
104
-        HRESULT hr = mft->ProcessMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, (ULONG_PTR)0);
105
-        isStreaming = SUCCEEDED(hr);
106
-        return hr;
107
-    }
108
-    HRESULT endStreaming()
109
-    {
110
-        assert(isStreaming);
111
-        HRESULT hr = mft->ProcessMessage(MFT_MESSAGE_NOTIFY_END_STREAMING, (ULONG_PTR)0);
112
-        isStreaming = SUCCEEDED(hr);
113
-        return hr;
114
-    }
115
     bool streamStarted = false;
116
-    HRESULT startStream()
117
-    {
118
-        assert(!streamStarted);
119
-        HRESULT hr = mft->ProcessMessage(MFT_MESSAGE_NOTIFY_START_OF_STREAM, (ULONG_PTR)0);
120
-        streamStarted = SUCCEEDED(hr);
121
-        return hr;
122
-    }
123
-    HRESULT endStream()
124
-    {
125
-        assert(streamStarted);
126
-        HRESULT hr = mft->ProcessMessage(MFT_MESSAGE_NOTIFY_END_OF_STREAM, (ULONG_PTR)0);
127
-        if (SUCCEEDED(hr))
128
-            streamStarted = false;
129
-        return hr;
130
-    }
131
-    HRESULT flushStream()
132
-    {
133
-        HRESULT hr = mft->ProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, 0);
134
-        if (streamStarted)
135
-        {
136
-            streamStarted = false;
137
-            startStream();
138
-        }
139
-        return hr;
140
-    }
141
 };
142
 
143
 struct mf_d3d11_pic_ctx
144
 {
145
     struct d3d11_pic_context ctx;
146
     IMFMediaBuffer *out_media;
147
-    decoder_sys_t  *mfdec;
148
+    mft_dec_sys_t  *mfdec;
149
 };
150
 #define MF_D3D11_PICCONTEXT_FROM_PICCTX(pic_ctx)  \
151
     container_of(pic_ctx, mf_d3d11_pic_ctx, ctx.s)
152
@@ -335,7 +331,7 @@
153
 
154
 static int SetInputType(decoder_t *p_dec, DWORD stream_id, ComPtr<IMFMediaType> & result)
155
 {
156
-    decoder_sys_t *p_sys = static_cast<decoder_sys_t*>(p_dec->p_sys);
157
+    mft_dec_sys_t *p_sys = static_cast<mft_dec_sys_t*>(p_dec->p_sys);
158
     HRESULT hr;
159
 
160
     result.Reset();
161
@@ -466,7 +462,7 @@
162
 
163
 static int SetOutputType(decoder_t *p_dec, DWORD stream_id)
164
 {
165
-    decoder_sys_t *p_sys = static_cast<decoder_sys_t*>(p_dec->p_sys);
166
+    mft_dec_sys_t *p_sys = static_cast<mft_dec_sys_t*>(p_dec->p_sys);
167
     HRESULT hr;
168
 
169
     ComPtr<IMFMediaType> output_media_type;
170
@@ -592,7 +588,7 @@
171
 
172
 static int AllocateInputSample(decoder_t *p_dec, DWORD stream_id, ComPtr<IMFSample> & result, DWORD size)
173
 {
174
-    decoder_sys_t *p_sys = static_cast<decoder_sys_t*>(p_dec->p_sys);
175
+    mft_dec_sys_t *p_sys = static_cast<mft_dec_sys_t*>(p_dec->p_sys);
176
     HRESULT hr;
177
 
178
     result.Reset();
179
@@ -630,7 +626,7 @@
180
 
181
 static int AllocateOutputSample(decoder_t *p_dec, DWORD stream_id, ComPtr<IMFSample> & result)
182
 {
183
-    decoder_sys_t *p_sys = static_cast<decoder_sys_t*>(p_dec->p_sys);
184
+    mft_dec_sys_t *p_sys = static_cast<mft_dec_sys_t*>(p_dec->p_sys);
185
     HRESULT hr;
186
 
187
     result.Reset();
188
@@ -690,7 +686,7 @@
189
 
190
 static int ProcessInputStream(decoder_t *p_dec, DWORD stream_id, block_t *p_block)
191
 {
192
-    decoder_sys_t *p_sys = static_cast<decoder_sys_t*>(p_dec->p_sys);
193
+    mft_dec_sys_t *p_sys = static_cast<mft_dec_sys_t*>(p_dec->p_sys);
194
     HRESULT hr = S_OK;
195
     ComPtr<IMFSample> input_sample;
196
 
197
@@ -794,7 +790,7 @@
198
 static void d3d11mf_pic_context_destroy(picture_context_t *ctx)
199
 {
200
     mf_d3d11_pic_ctx *pic_ctx = MF_D3D11_PICCONTEXT_FROM_PICCTX(ctx);
201
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/codec/png.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/codec/png.c Changed
99
 
1
@@ -30,6 +30,7 @@
2
 #include <vlc_common.h>
3
 #include <vlc_plugin.h>
4
 #include <vlc_codec.h>
5
+#include <vlc_rand.h>
6
 #include <png.h>
7
 
8
 /* PNG_SYS_COMMON_MEMBERS:
9
@@ -181,6 +182,53 @@
10
     msg_Warn( p_sys->p_obj, "%s", warning_msg );
11
 }
12
 
13
+#ifdef PNG_TEXT_SUPPORTED
14
+static void process_text_chunk( decoder_t *p_dec, const png_textp chunk )
15
+{
16
+    if( chunk->compression != PNG_ITXT_COMPRESSION_NONE ||
17
+        memcmp( chunk->key, "XML:com.adobe.xmp", 17 ) ||
18
+        chunk->itxt_length < 20 )
19
+        return;
20
+
21
+    const char *exifxmp = (const char *) chunk->text;
22
+    const char *orient = strnstr( exifxmp, ":Orientation>", chunk->itxt_length );
23
+    if(orient && orient - exifxmp > 14)
24
+        p_dec->fmt_out.video.orientation = ORIENT_FROM_EXIF( orient[13] - '0' );
25
+}
26
+
27
+static int make_xmp_packet( const video_format_t *fmt, png_textp chunk )
28
+{
29
+    unsigned char id[9];
30
+    vlc_rand_bytes(id, 8);
31
+    for(int i=0; i<8; i++)
32
+        id[i] = (id[i] % 26) + 'A';
33
+    id[8] = '\0';
34
+    int len = asprintf( &chunk->text,
35
+            "<?xpacket begin='' id='%s'?>"
36
+             "<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='VLC " VERSION "'>"
37
+              "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>"
38
+               "<rdf:Description rdf:about='' xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>"
39
+                "<tiff:Orientation>%" PRIu8 "</tiff:Orientation>"
40
+               "</rdf:Description>"
41
+              "</rdf:RDF>"
42
+             "</x:xmpmeta>"
43
+            "<?xpacket end='r'?>", id, ORIENT_TO_EXIF(fmt->orientation) );
44
+    if(len == 0)
45
+    {
46
+        free(chunk->text);
47
+        chunk->text = NULL;
48
+    }
49
+    chunk->itxt_length = (len <= 0) ? 0 : len;
50
+    chunk->compression = PNG_ITXT_COMPRESSION_NONE;
51
+    chunk->key = len > 0 ? strdup( "XML:com.adobe.xmp" ) : NULL;
52
+    chunk->lang_key = NULL;
53
+    chunk->lang = NULL;
54
+    chunk->text_length = 0;
55
+    return len > 0 ? VLC_SUCCESS : VLC_EGENERIC;
56
+}
57
+
58
+#endif
59
+
60
 /****************************************************************************
61
  * DecodeBlock: the whole thing
62
  ****************************************************************************
63
@@ -255,6 +303,14 @@
64
     p_dec->fmt_out.video.i_sar_num = 1;
65
     p_dec->fmt_out.video.i_sar_den = 1;
66
 
67
+#ifdef PNG_TEXT_SUPPORTED
68
+    png_textp textp;
69
+    int numtextp;
70
+    if( png_get_text( p_png, p_info, &textp, &numtextp ) > 0 )
71
+        for( int ii=0; ii<numtextp; ii++ )
72
+            process_text_chunk( p_dec, &textp[ii] );
73
+#endif
74
+
75
     if( i_color_type == PNG_COLOR_TYPE_PALETTE )
76
         png_set_palette_to_rgb( p_png );
77
 
78
@@ -403,7 +459,19 @@
79
             PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT );
80
     if( p_sys->b_error ) goto error;
81
 
82
-    png_write_info( p_png, p_info );
83
+#ifdef PNG_TEXT_SUPPORTED
84
+    png_text text;
85
+    if( make_xmp_packet( &p_pic->format, &text ) == VLC_SUCCESS )
86
+    {
87
+        png_set_text( p_png, p_info, &text, 1 );
88
+        png_write_info( p_png, p_info );
89
+        free( text.key );
90
+        free( text.text );
91
+    }
92
+    else
93
+#endif
94
+        png_write_info( p_png, p_info );
95
+
96
     if( p_sys->b_error ) goto error;
97
 
98
     /* Encode picture */
99
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/gui/macosx/panels/VLCVideoEffectsWindowController.m -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/gui/macosx/panels/VLCVideoEffectsWindowController.m Changed
50
 
1
@@ -182,7 +182,7 @@
2
     [VLCVideoFilterHelper setVideoFilterProperty: "wall-cols" forFilter: "wall" withValue: getWidgetIntValue([items objectAtIndex:31])];
3
 
4
     if ([items count] >= 33) { // version >=2 of profile string
5
-        [VLCVideoFilterHelper setVideoFilterProperty: "brightness-threshold" forFilter: "adjust" withValue: (vlc_value_t){ .b_bool = [[items objectAtIndex:32] intValue] }];
6
+        /* "brightness-threshold" at 32 */
7
     }
8
 
9
     vlc_value_t hueValue;
10
@@ -571,7 +571,6 @@
11
     [self setWidgetValue: _adjustContrastSlider forOption: "contrast" enabled: b_state];
12
     [self setWidgetValue: _adjustBrightnessSlider forOption: "brightness" enabled: b_state];
13
     [self setWidgetValue: _adjustSaturationSlider forOption: "saturation" enabled: b_state];
14
-    [self setWidgetValue: _adjustBrightnessCheckbox forOption: "brightness-threshold" enabled: b_state];
15
     [self setWidgetValue: _adjustGammaSlider forOption: "gamma" enabled: b_state];
16
     [_adjustBrightnessLabel setEnabled: b_state];
17
     [_adjustContrastLabel setEnabled: b_state];
18
@@ -704,7 +703,7 @@
19
                      var_InheritInteger(vout, "wall-rows"),
20
                      var_InheritInteger(vout, "wall-cols"),
21
                      // version 2 of profile string:
22
-                     (int64_t)var_InheritBool(vout, "brightness-threshold"), // index: 32
23
+                     0LL /* "brightness-threshold" */, // index: 32
24
                      // version 3 of profile string: (vlc-3.0.0)
25
                      var_InheritFloat(vout, "hue") // index: 33
26
             ];
27
@@ -927,7 +926,7 @@
28
 
29
         [VLCVideoFilterHelper setVideoFilter: "adjust" on: b_state];
30
         [_adjustBrightnessSlider setEnabled: b_state];
31
-        [_adjustBrightnessCheckbox setEnabled: b_state];
32
+        [_adjustBrightnessCheckbox setEnabled: NO];
33
         [_adjustBrightnessLabel setEnabled: b_state];
34
         [_adjustContrastSlider setEnabled: b_state];
35
         [_adjustContrastLabel setEnabled: b_state];
36
@@ -964,13 +963,6 @@
37
         [sender setToolTip: [NSString stringWithFormat:@"%0.3f", [sender floatValue]]];
38
 }
39
 
40
-- (IBAction)enableAdjustBrightnessThreshold:(id)sender
41
-{
42
-    [VLCVideoFilterHelper setVideoFilterProperty: "brightness-threshold"
43
-                                                      forFilter: "adjust"
44
-                                                      withValue: getWidgetBoolValue(sender)];
45
-}
46
-
47
 - (IBAction)enableSharpen:(id)sender
48
 {
49
     BOOL b_state = [_sharpenCheckbox state];
50
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/gui/qt/player/qml/SliderBar.qml -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/gui/qt/player/qml/SliderBar.qml Changed
40
 
1
@@ -148,8 +148,19 @@
2
 
3
             states: [
4
                 State {
5
+                    name: "hidden"
6
+                    when: !control.visible
7
+                    PropertyChanges {
8
+                        target: bufferRect
9
+                        width: bufferAnimWidth
10
+                        visible: false
11
+                        x: 0
12
+                        animateLoading: false
13
+                    }
14
+                },
15
+                State {
16
                     name: "buffering not started"
17
-                    when: Player.buffering === 0
18
+                    when: control.visible && Player.buffering === 0
19
                     PropertyChanges {
20
                         target: bufferRect
21
                         width: bufferAnimWidth
22
@@ -160,7 +171,7 @@
23
                 },
24
                 State {
25
                     name: "time to start playing known"
26
-                    when: Player.buffering < 1
27
+                    when: control.visible && Player.buffering < 1
28
                     PropertyChanges {
29
                         target: bufferRect
30
                         width: Player.buffering * parent.width
31
@@ -171,7 +182,7 @@
32
                 },
33
                 State {
34
                     name: "playing from buffer"
35
-                    when: Player.buffering === 1
36
+                    when: control.visible && Player.buffering === 1
37
                     PropertyChanges {
38
                         target: bufferRect
39
                         width: Player.buffering * parent.width
40
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/hw/d3d11/d3d11_filters.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/hw/d3d11/d3d11_filters.c Changed
66
 
1
@@ -63,7 +63,6 @@
2
 typedef struct
3
 {
4
     float f_gamma;
5
-    bool  b_brightness_threshold;
6
 
7
     struct filter_level Brightness;
8
     struct filter_level Contrast;
9
@@ -81,10 +80,6 @@
10
     ID3D11VideoProcessorOutputView *procOutput[PROCESSOR_SLICES];
11
 } filter_sys_t;
12
 
13
-#define THRES_TEXT N_("Brightness threshold")
14
-#define THRES_LONGTEXT N_("When this mode is enabled, pixels will be " \
15
-        "shown as black or white. The threshold value will be the brightness " \
16
-        "defined below." )
17
 #define CONT_TEXT N_("Image contrast (0-2)")
18
 #define CONT_LONGTEXT N_("Set the image contrast, between 0 and 2. Defaults to 1.")
19
 #define HUE_TEXT N_("Image hue (0-360)")
20
@@ -97,8 +92,7 @@
21
 #define GAMMA_LONGTEXT N_("Set the image gamma, between 0.01 and 10. Defaults to 1.")
22
 
23
 static const char *const ppsz_filter_options[] = {
24
-    "contrast", "brightness", "hue", "saturation", "gamma",
25
-    "brightness-threshold", NULL
26
+    "contrast", "brightness", "hue", "saturation", "gamma", NULL
27
 };
28
 
29
 static bool ApplyFilter( filter_sys_t *p_sys,
30
@@ -344,8 +338,6 @@
31
     var_DelCallback( filter, "hue",        AdjustCallback, sys );
32
     var_DelCallback( filter, "saturation", AdjustCallback, sys );
33
     var_DelCallback( filter, "gamma",      AdjustCallback, sys );
34
-    var_DelCallback( filter, "brightness-threshold",
35
-                                             AdjustCallback, sys );
36
 
37
     for (int i=0; i<PROCESSOR_SLICES; i++)
38
     {
39
@@ -455,16 +447,12 @@
40
     InitLevel(filter, &sys->Hue,        "hue",        0.0 );
41
     InitLevel(filter, &sys->Saturation, "saturation", 1.0 );
42
     sys->f_gamma = var_CreateGetFloatCommand( filter, "gamma" );
43
-    sys->b_brightness_threshold =
44
-        var_CreateGetBoolCommand( filter, "brightness-threshold" );
45
 
46
     var_AddCallback( filter, "contrast",   AdjustCallback, sys );
47
     var_AddCallback( filter, "brightness", AdjustCallback, sys );
48
     var_AddCallback( filter, "hue",        AdjustCallback, sys );
49
     var_AddCallback( filter, "saturation", AdjustCallback, sys );
50
     var_AddCallback( filter, "gamma",      AdjustCallback, sys );
51
-    var_AddCallback( filter, "brightness-threshold",
52
-                                             AdjustCallback, sys );
53
 
54
     hr = ID3D11VideoDevice_CreateVideoProcessor(sys->d3d_proc.d3dviddev,
55
                                                 sys->d3d_proc.procEnumerator, 0,
56
@@ -584,9 +572,6 @@
57
     add_float_with_range( "gamma", 1.0, 0.01, 10.0,
58
                           GAMMA_TEXT, GAMMA_LONGTEXT )
59
         change_safe()
60
-    add_bool( "brightness-threshold", false,
61
-              THRES_TEXT, THRES_LONGTEXT )
62
-        change_safe()
63
 
64
     add_submodule()
65
     set_description(N_("Direct3D11 deinterlace filter"))
66
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/hw/d3d9/d3d9_filters.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/hw/d3d9/d3d9_filters.c Changed
41
 
1
@@ -63,10 +63,6 @@
2
     struct filter_level Saturation;
3
 } filter_sys_t;
4
 
5
-#define THRES_TEXT N_("Brightness threshold")
6
-#define THRES_LONGTEXT N_("When this mode is enabled, pixels will be " \
7
-        "shown as black or white. The threshold value will be the brightness " \
8
-        "defined below." )
9
 #define CONT_TEXT N_("Image contrast (0-2)")
10
 #define CONT_LONGTEXT N_("Set the image contrast, between 0 and 2. Defaults to 1.")
11
 #define HUE_TEXT N_("Image hue (0-360)")
12
@@ -79,8 +75,7 @@
13
 #define GAMMA_LONGTEXT N_("Set the image gamma, between 0.01 and 10. Defaults to 1.")
14
 
15
 static const char *const ppsz_filter_options[] = {
16
-    "contrast", "brightness", "hue", "saturation", "gamma",
17
-    "brightness-threshold", NULL
18
+    "contrast", "brightness", "hue", "saturation", "gamma", NULL
19
 };
20
 
21
 static void FillSample( DXVA2_VideoSample *p_sample,
22
@@ -431,8 +426,6 @@
23
     var_AddCallback( filter, "hue",        AdjustCallback, sys );
24
     var_AddCallback( filter, "saturation", AdjustCallback, sys );
25
     var_AddCallback( filter, "gamma",      AdjustCallback, sys );
26
-    var_AddCallback( filter, "brightness-threshold",
27
-                                             AdjustCallback, sys );
28
 
29
     hr = IDirectXVideoProcessorService_CreateVideoProcessor( processor,
30
                                                              processorGUID,
31
@@ -506,9 +499,6 @@
32
     add_float_with_range( "gamma", 1.0, 0.01, 10.0,
33
                           GAMMA_TEXT, GAMMA_LONGTEXT )
34
         change_safe()
35
-    add_bool( "brightness-threshold", false,
36
-              THRES_TEXT, THRES_LONGTEXT )
37
-        change_safe()
38
 
39
     add_submodule()
40
     set_description(N_("Direct3D9 deinterlace filter"))
41
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/video_chroma/orient.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/video_chroma/orient.c Changed
201
 
1
@@ -34,189 +34,147 @@
2
 #include <vlc_mouse.h>
3
 #include <vlc_picture.h>
4
 
5
-static void HFlip(int *sx, int *sy, int w, int h, int dx, int dy)
6
+static void vflip(void *restrict dst, ptrdiff_t dst_stride,
7
+                  const void *restrict src, ptrdiff_t src_stride,
8
+                  int width, int height, int order)
9
 {
10
-    VLC_UNUSED( h );
11
-    *sx = w - 1 - dx;
12
-    *sy = dy;
13
-}
14
-static void VFlip(int *sx, int *sy, int w, int h, int dx, int dy)
15
-{
16
-    VLC_UNUSED( w );
17
-    *sx = dx;
18
-    *sy = h - 1 - dy;
19
-}
20
-static void Transpose(int *sx, int *sy, int w, int h, int dx, int dy)
21
-{
22
-    VLC_UNUSED( h ); VLC_UNUSED( w );
23
-    *sx = dy;
24
-    *sy = dx;
25
-}
26
-static void AntiTranspose(int *sx, int *sy, int w, int h, int dx, int dy)
27
-{
28
-    *sx = h - 1 - dy;
29
-    *sy = w - 1 - dx;
30
-}
31
-static void R90(int *sx, int *sy, int w, int h, int dx, int dy)
32
-{
33
-    VLC_UNUSED( h );
34
-    *sx = dy;
35
-    *sy = w - 1 - dx;
36
-}
37
-static void R180(int *sx, int *sy, int w, int h, int dx, int dy)
38
-{
39
-    *sx = w - 1 - dx;
40
-    *sy = h - 1 - dy;
41
-}
42
-static void R270(int *sx, int *sy, int w, int h, int dx, int dy)
43
-{
44
-    VLC_UNUSED( w );
45
-    *sx = h - 1 - dy;
46
-    *sy = dx;
47
-}
48
-typedef void (*convert_t)(int *, int *, int, int, int, int);
49
+    const unsigned char *src_pixels = src;
50
+    unsigned char *restrict dst_pixels = dst;
51
+    size_t visible_pitch = width << order;
52
 
53
-#define PLANE(f,bits) \
54
-static void Plane##bits##_##f(plane_t *restrict dst, const plane_t *restrict src) \
55
-{ \
56
-    const uint##bits##_t *src_pixels = (const void *)src->p_pixels; \
57
-    uint##bits##_t *restrict dst_pixels = (void *)dst->p_pixels; \
58
-    const unsigned src_width = src->i_pitch / sizeof (*src_pixels); \
59
-    const unsigned dst_width = dst->i_pitch / sizeof (*dst_pixels); \
60
-    const unsigned dst_visible_width = dst->i_visible_pitch / sizeof (*dst_pixels); \
61
- \
62
-    for (int y = 0; y < dst->i_visible_lines; y++) { \
63
-        for (unsigned x = 0; x < dst_visible_width; x++) { \
64
-            int sx, sy; \
65
-            (f)(&sx, &sy, dst_visible_width, dst->i_visible_lines, x, y); \
66
-            dst_pixels[y * dst_width + x] = \
67
-                src_pixels[sy * src_width + sx]; \
68
-        } \
69
-    } \
70
-}
71
+    dst_pixels += dst_stride * height;
72
 
73
-static void Plane_VFlip(plane_t *restrict dst, const plane_t *restrict src)
74
-{
75
-    const uint8_t *src_pixels = src->p_pixels;
76
-    uint8_t *restrict dst_pixels = dst->p_pixels;
77
-
78
-    dst_pixels += dst->i_pitch * dst->i_visible_lines;
79
-    for (int y = 0; y < dst->i_visible_lines; y++) {
80
-        dst_pixels -= dst->i_pitch;
81
-        memcpy(dst_pixels, src_pixels, dst->i_visible_pitch);
82
-        src_pixels += src->i_pitch;
83
+    for (int y = 0; y < height; y++) {
84
+        dst_pixels -= dst_stride;
85
+        memcpy(dst_pixels, src_pixels, visible_pitch);
86
+        src_pixels += src_stride;
87
     }
88
 }
89
 
90
-#define I422(f) \
91
-static void Plane422_##f(plane_t *restrict dst, const plane_t *restrict src) \
92
+#define TRANSFORMS(bits) \
93
+static void hflip_##bits(void *restrict dst, ptrdiff_t dst_stride, \
94
+                         const void *restrict src, ptrdiff_t src_stride, \
95
+                         int width, int height) \
96
 { \
97
-    for (int y = 0; y < dst->i_visible_lines; y += 2) { \
98
-        for (int x = 0; x < dst->i_visible_pitch; x++) { \
99
-            int sx, sy, uv; \
100
-            (f)(&sx, &sy, dst->i_visible_pitch, dst->i_visible_lines / 2, \
101
-                x, y / 2); \
102
-            uv = (1 + src->p_pixels[2 * sy * src->i_pitch + sx] + \
103
-                src->p_pixels[(2 * sy + 1) * src->i_pitch + sx]) / 2; \
104
-            dst->p_pixels[y * dst->i_pitch + x] = uv; \
105
-            dst->p_pixels[(y + 1) * dst->i_pitch + x] = uv; \
106
-        } \
107
+    const uint##bits##_t *restrict src_pixels = src; \
108
+    uint##bits##_t *restrict dst_pixels = dst; \
109
+\
110
+    dst_stride /= bits / 8; \
111
+    src_stride /= bits / 8; \
112
+    dst_pixels += width - 1; \
113
+\
114
+    for (int y = 0; y < height; y++) { \
115
+        for (int x = 0; x < width; x++) \
116
+            dst_pixels[-x] = src_pixels[x]; \
117
+\
118
+        src_pixels += src_stride; \
119
+        dst_pixels += dst_stride; \
120
     } \
121
-}
122
-
123
-#define YUY2(f) \
124
-static void PlaneYUY2_##f(plane_t *restrict dst, const plane_t *restrict src) \
125
+} \
126
+\
127
+static void vflip_##bits(void *restrict dst, ptrdiff_t dst_stride, \
128
+                         const void *restrict src, ptrdiff_t src_stride, \
129
+                         int width, int height) \
130
+{ \
131
+    vflip(dst, dst_stride, src, src_stride, width, height, ctz(bits / 8)); \
132
+} \
133
+\
134
+static void r180_##bits(void *restrict dst, ptrdiff_t dst_stride, \
135
+                        const void *restrict src, ptrdiff_t src_stride, \
136
+                        int width, int height) \
137
+{ \
138
+    const unsigned char *src_pixels = src; \
139
+\
140
+    src_pixels += (height - 1) * src_stride; \
141
+    src_stride *= -1; \
142
+    hflip_##bits(dst, dst_stride, src_pixels, src_stride, width, height); \
143
+} \
144
+\
145
+static void transpose_##bits(void *restrict dst, ptrdiff_t dst_stride, \
146
+                             const void *restrict src, ptrdiff_t src_stride, \
147
+                             int src_width, int src_height) \
148
 { \
149
-    unsigned dst_visible_width = dst->i_visible_pitch / 2; \
150
- \
151
-    for (int y = 0; y < dst->i_visible_lines; y += 2) { \
152
-        for (unsigned x = 0; x < dst_visible_width; x+= 2) { \
153
-            int sx0, sy0, sx1, sy1; \
154
-            (f)(&sx0, &sy0, dst_visible_width, dst->i_visible_lines, x, y); \
155
-            (f)(&sx1, &sy1, dst_visible_width, dst->i_visible_lines, \
156
-                x + 1, y + 1); \
157
-            dst->p_pixels[(y + 0) * dst->i_pitch + 2 * (x + 0)] = \
158
-                src->p_pixels[sy0 * src->i_pitch + 2 * sx0]; \
159
-            dst->p_pixels[(y + 0) * dst->i_pitch + 2 * (x + 1)] = \
160
-                src->p_pixels[sy1 * src->i_pitch + 2 * sx0]; \
161
-            dst->p_pixels[(y + 1) * dst->i_pitch + 2 * (x + 0)] = \
162
-                src->p_pixels[sy0 * src->i_pitch + 2 * sx1]; \
163
-            dst->p_pixels[(y + 1) * dst->i_pitch + 2 * (x + 1)] = \
164
-                src->p_pixels[sy1 * src->i_pitch + 2 * sx1]; \
165
- \
166
-            int sx, sy, u, v; \
167
-            (f)(&sx, &sy, dst_visible_width / 2, dst->i_visible_lines / 2, \
168
-                x / 2, y / 2); \
169
-            u = (1 + src->p_pixels[2 * sy * src->i_pitch + 4 * sx + 1] + \
170
-                src->p_pixels[(2 * sy + 1) * src->i_pitch + 4 * sx + 1]) / 2; \
171
-            v = (1 + src->p_pixels[2 * sy * src->i_pitch + 4 * sx + 3] + \
172
-                src->p_pixels[(2 * sy + 1) * src->i_pitch + 4 * sx + 3]) / 2; \
173
-            dst->p_pixels[(y + 0) * dst->i_pitch + 2 * x + 1] = u; \
174
-            dst->p_pixels[(y + 0) * dst->i_pitch + 2 * x + 3] = v; \
175
-            dst->p_pixels[(y + 1) * dst->i_pitch + 2 * x + 1] = u; \
176
-            dst->p_pixels[(y + 1) * dst->i_pitch + 2 * x + 3] = v; \
177
-        } \
178
+    const uint##bits##_t *restrict src_pixels = src; \
179
+    uint##bits##_t *restrict dst_pixels = dst; \
180
+\
181
+    dst_stride /= bits / 8; \
182
+    src_stride /= bits / 8; \
183
+\
184
+    for (int y = 0; y < src_height; y++) { \
185
+        for (int x = 0; x < src_width; x++) \
186
+            dst_pixels[x * dst_stride] = src_pixels[x]; \
187
+        src_pixels += src_stride; \
188
+        dst_pixels++; \
189
     } \
190
+} \
191
+\
192
+static void r270_##bits(void *restrict dst, ptrdiff_t dst_stride, \
193
+                        const void *restrict src, ptrdiff_t src_stride, \
194
+                        int src_width, int src_height) \
195
+{ \
196
+    unsigned char *dst_pixels = dst; \
197
+\
198
+    dst_pixels += (src_width - 1) * dst_stride; \
199
+    dst_stride *= -1; \
200
+    transpose_##bits(dst_pixels, dst_stride, src, src_stride, \
201
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/video_filter/adjust.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/video_filter/adjust.c Changed
178
 
1
@@ -52,10 +52,6 @@
2
  * Module descriptor
3
  *****************************************************************************/
4
 
5
-#define THRES_TEXT N_("Brightness threshold")
6
-#define THRES_LONGTEXT N_("When this mode is enabled, pixels will be " \
7
-        "shown as black or white. The threshold value will be the brightness " \
8
-        "defined below." )
9
 #define CONT_TEXT N_("Image contrast (0-2)")
10
 #define CONT_LONGTEXT N_("Set the image contrast, between 0 and 2. Defaults to 1.")
11
 #define HUE_TEXT N_("Image hue (-180..180)")
12
@@ -87,17 +83,14 @@
13
     add_float_with_range( "gamma", 1.0, 0.01, 10.0,
14
                           GAMMA_TEXT, GAMMA_LONGTEXT )
15
         change_safe()
16
-    add_bool( "brightness-threshold", false,
17
-              THRES_TEXT, THRES_LONGTEXT )
18
-        change_safe()
19
+    add_obsolete_bool("brightness-threshold") /* since 4.0.0 */
20
 
21
     add_shortcut( "adjust" )
22
     set_callback_video_filter( Create )
23
 vlc_module_end ()
24
 
25
 static const char *const ppsz_filter_options[] = {
26
-    "contrast", "brightness", "hue", "saturation", "gamma",
27
-    "brightness-threshold", NULL
28
+    "contrast", "brightness", "hue", "saturation", "gamma", NULL
29
 };
30
 
31
 /*****************************************************************************
32
@@ -110,7 +103,6 @@
33
     _Atomic float f_hue;
34
     _Atomic float f_saturation;
35
     _Atomic float f_gamma;
36
-    atomic_bool  b_brightness_threshold;
37
     int (*pf_process_sat_hue)( picture_t *, picture_t *, int, int, int,
38
                                int, int );
39
     int (*pf_process_sat_hue_clip)( picture_t *, picture_t *, int, int,
40
@@ -206,8 +198,6 @@
41
                  var_CreateGetFloatCommand( p_filter, "saturation" ) );
42
     atomic_init( &p_sys->f_gamma,
43
                  var_CreateGetFloatCommand( p_filter, "gamma" ) );
44
-    atomic_init( &p_sys->b_brightness_threshold,
45
-                 var_CreateGetBoolCommand( p_filter, "brightness-threshold" ) );
46
 
47
     var_AddCallback( p_filter, "contrast", FloatCallback, &p_sys->f_contrast );
48
     var_AddCallback( p_filter, "brightness", FloatCallback,
49
@@ -216,8 +206,6 @@
50
     var_AddCallback( p_filter, "saturation", FloatCallback,
51
                      &p_sys->f_saturation );
52
     var_AddCallback( p_filter, "gamma", FloatCallback, &p_sys->f_gamma );
53
-    var_AddCallback( p_filter, "brightness-threshold", BoolCallback,
54
-                     &p_sys->b_brightness_threshold );
55
 
56
     return VLC_SUCCESS;
57
 }
58
@@ -236,8 +224,6 @@
59
     var_DelCallback( p_filter, "saturation", FloatCallback,
60
                      &p_sys->f_saturation );
61
     var_DelCallback( p_filter, "gamma", FloatCallback, &p_sys->f_gamma );
62
-    var_DelCallback( p_filter, "brightness-threshold", BoolCallback,
63
-                     &p_sys->b_brightness_threshold );
64
 }
65
 
66
 /*****************************************************************************
67
@@ -281,44 +267,20 @@
68
     int i_sat = (int)( atomic_load_explicit( &p_sys->f_saturation, memory_order_relaxed ) * f_range );
69
     float f_gamma = 1.f / atomic_load_explicit( &p_sys->f_gamma, memory_order_relaxed );
70
 
71
-    /*
72
-     * Threshold mode drops out everything about luma, contrast and gamma.
73
-     */
74
-    if( !atomic_load_explicit( &p_sys->b_brightness_threshold,
75
-                               memory_order_relaxed ) )
76
-    {
77
-
78
-        /* Contrast is a fast but kludged function, so I put this gap to be
79
-         * cleaner :) */
80
-        i_lum += i_mid - i_cont / 2;
81
-
82
-        /* Fill the gamma lookup table */
83
-        for( unsigned i = 0 ; i < i_size; i++ )
84
-        {
85
-            pi_gamma[ i ] = VLC_CLIP( powf(i / f_max, f_gamma) * f_max, 0, i_max );
86
-        }
87
+    /* Contrast is a fast but kludged function, so I put this gap to be
88
+     * cleaner :) */
89
+    i_lum += i_mid - i_cont / 2;
90
 
91
-        /* Fill the luma lookup table */
92
-        for( unsigned i = 0 ; i < i_size; i++ )
93
-        {
94
-            pi_luma[ i ] = pi_gamma[VLC_CLIP( (int)(i_lum + i_cont * i / i_range), 0, (int) i_max )];
95
-        }
96
-    }
97
-    else
98
+    /* Fill the gamma lookup table */
99
+    for( unsigned i = 0 ; i < i_size; i++ )
100
     {
101
-        /*
102
-         * We get luma as threshold value: the higher it is, the darker is
103
-         * the image. Should I reverse this?
104
-         */
105
-        for( int i = 0 ; i < i_range; i++ )
106
-        {
107
-            pi_luma[ i ] = (i < i_lum) ? 0 : i_max;
108
-        }
109
+        pi_gamma[ i ] = VLC_CLIP( powf(i / f_max, f_gamma) * f_max, 0, i_max );
110
+    }
111
 
112
-        /*
113
-         * Desaturates image to avoid that strange yellow halo...
114
-         */
115
-        i_sat = 0;
116
+    /* Fill the luma lookup table */
117
+    for( unsigned i = 0 ; i < i_size; i++ )
118
+    {
119
+        pi_luma[ i ] = pi_gamma[VLC_CLIP( (int)(i_lum + i_cont * i / i_range), 0, (int) i_max )];
120
     }
121
 
122
     /*
123
@@ -477,43 +439,20 @@
124
     i_sat = (int)( atomic_load_explicit( &p_sys->f_saturation, memory_order_relaxed ) * 256 );
125
     f_gamma = 1.0 / atomic_load_explicit( &p_sys->f_gamma, memory_order_relaxed );
126
 
127
-    /*
128
-     * Threshold mode drops out everything about luma, contrast and gamma.
129
-     */
130
-    if( !atomic_load_explicit( &p_sys->b_brightness_threshold, memory_order_relaxed ) )
131
-    {
132
-
133
-        /* Contrast is a fast but kludged function, so I put this gap to be
134
-         * cleaner :) */
135
-        i_lum += 128 - i_cont / 2;
136
+    /* Contrast is a fast but kludged function, so I put this gap to be
137
+     * cleaner :) */
138
+    i_lum += 128 - i_cont / 2;
139
 
140
-        /* Fill the gamma lookup table */
141
-        for( int i = 0 ; i < 256 ; i++ )
142
-        {
143
-          pi_gamma[ i ] = clip_uint8_vlc( pow(i / 255.0, f_gamma) * 255.0);
144
-        }
145
-
146
-        /* Fill the luma lookup table */
147
-        for( int i = 0 ; i < 256 ; i++ )
148
-        {
149
-            pi_luma[ i ] = pi_gamma[clip_uint8_vlc( i_lum + i_cont * i / 256)];
150
-        }
151
-    }
152
-    else
153
+    /* Fill the gamma lookup table */
154
+    for( int i = 0 ; i < 256 ; i++ )
155
     {
156
-        /*
157
-         * We get luma as threshold value: the higher it is, the darker is
158
-         * the image. Should I reverse this?
159
-         */
160
-        for( int i = 0 ; i < 256 ; i++ )
161
-        {
162
-            pi_luma[ i ] = (i < i_lum) ? 0 : 255;
163
-        }
164
+        pi_gamma[ i ] = clip_uint8_vlc( pow(i / 255.0, f_gamma) * 255.0);
165
+    }
166
 
167
-        /*
168
-         * Desaturates image to avoid that strange yellow halo...
169
-         */
170
-        i_sat = 0;
171
+    /* Fill the luma lookup table */
172
+    for( int i = 0 ; i < 256 ; i++ )
173
+    {
174
+        pi_luma[ i ] = pi_gamma[clip_uint8_vlc( i_lum + i_cont * i / 256)];
175
     }
176
 
177
     /*
178
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/video_filter/rotate.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/video_filter/rotate.c Changed
154
 
1
@@ -82,40 +82,26 @@
2
     "angle", "use-motion", NULL
3
 };
4
 
5
-/*****************************************************************************
6
- * filter_sys_t
7
- *****************************************************************************/
8
+typedef struct {
9
+    int16_t sin;
10
+    int16_t cos;
11
+} sincos_t;
12
+
13
 typedef struct
14
 {
15
-    atomic_uint_fast32_t sincos;
16
+    _Atomic sincos_t sincos;
17
     motion_sensors_t *p_motion;
18
 } filter_sys_t;
19
 
20
-typedef union {
21
-    uint32_t u;
22
-    struct {
23
-        int16_t sin;
24
-        int16_t cos;
25
-    };
26
-} sincos_t;
27
-
28
 static void store_trigo( filter_sys_t *sys, float f_angle )
29
 {
30
     sincos_t sincos;
31
 
32
     f_angle *= (float)(M_PI / 180.); /* degrees -> radians */
33
 
34
-    sincos.sin = lroundf(sinf(f_angle) * 4096.f);
35
-    sincos.cos = lroundf(cosf(f_angle) * 4096.f);
36
-    atomic_store(&sys->sincos, sincos.u);
37
-}
38
-
39
-static void fetch_trigo( filter_sys_t *sys, int *i_sin, int *i_cos )
40
-{
41
-    sincos_t sincos = { .u = atomic_load(&sys->sincos) };
42
-
43
-    *i_sin = sincos.sin;
44
-    *i_cos = sincos.cos;
45
+    sincos.sin = lroundf(ldexpf(sinf(f_angle), 12));
46
+    sincos.cos = lroundf(ldexpf(cosf(f_angle), 12));
47
+    atomic_store_explicit(&sys->sincos, sincos, memory_order_relaxed);
48
 }
49
 
50
 static const struct vlc_filter_operations packed_filter_ops =
51
@@ -220,17 +206,15 @@
52
         store_trigo( p_sys, i_angle / 20.f );
53
     }
54
 
55
-    int i_sin, i_cos;
56
-    fetch_trigo( p_sys, &i_sin, &i_cos );
57
-
58
     p_mouse->i_x = ( p_fmt->i_visible_width >> 1 );
59
     p_mouse->i_y = ( p_fmt->i_visible_height >> 1 );
60
 
61
     const int i_rx = ( i_x - p_mouse->i_x );
62
     const int i_ry = ( i_y - p_mouse->i_y );
63
+    sincos_t sc = atomic_load_explicit(&p_sys->sincos, memory_order_relaxed);
64
 
65
-    p_mouse->i_x += ( ( i_rx * i_cos - i_ry * i_sin )>> 12 );
66
-    p_mouse->i_y += ( ( i_rx * i_sin + i_ry * i_cos )>> 12 );
67
+    p_mouse->i_x += ( ( i_rx * sc.cos - i_ry * sc.sin )>> 12 );
68
+    p_mouse->i_y += ( ( i_rx * sc.sin + i_ry * sc.cos )>> 12 );
69
 
70
     return VLC_SUCCESS;
71
 }
72
@@ -248,8 +232,7 @@
73
         store_trigo( p_sys, i_angle / 20.f );
74
     }
75
 
76
-    int i_sin, i_cos;
77
-    fetch_trigo( p_sys, &i_sin, &i_cos );
78
+    sincos_t sc = atomic_load_explicit(&p_sys->sincos, memory_order_relaxed);
79
 
80
     for( int i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
81
     {
82
@@ -267,12 +250,12 @@
83
 
84
         const uint8_t black_pixel = ( i_plane == Y_PLANE ) ? 0x00 : 0x80;
85
 
86
-        const int i_line_next =  i_cos / i_aspect -i_sin*i_visible_pitch;
87
-        const int i_col_next  = -i_sin / i_aspect -i_cos*i_visible_pitch;
88
-        int i_line_orig0 = ( - i_cos * i_line_center / i_aspect
89
-                             - i_sin * i_col_center + (1<<11) );
90
-        int i_col_orig0 =    i_sin * i_line_center / i_aspect
91
-                           - i_cos * i_col_center + (1<<11);
92
+        const int i_line_next =  sc.cos / i_aspect -sc.sin*i_visible_pitch;
93
+        const int i_col_next  = -sc.sin / i_aspect -sc.cos*i_visible_pitch;
94
+        int i_line_orig0 = ( - sc.cos * i_line_center / i_aspect
95
+                             - sc.sin * i_col_center + (1<<11) );
96
+        int i_col_orig0 =    sc.sin * i_line_center / i_aspect
97
+                           - sc.cos * i_col_center + (1<<11);
98
         for( int y = 0; y < i_visible_lines; y++)
99
         {
100
             uint8_t *p_out = &p_dstp->p_pixels[y * p_dstp->i_pitch];
101
@@ -341,8 +324,8 @@
102
                     *p_out = black_pixel;
103
                 }
104
 
105
-                i_line_orig0 += i_sin;
106
-                i_col_orig0 += i_cos;
107
+                i_line_orig0 += sc.sin;
108
+                i_col_orig0 += sc.cos;
109
             }
110
 
111
             i_line_orig0 += i_line_next;
112
@@ -401,8 +384,7 @@
113
         store_trigo( p_sys, i_angle / 20.f );
114
     }
115
 
116
-    int i_sin, i_cos;
117
-    fetch_trigo( p_sys, &i_sin, &i_cos );
118
+    sincos_t sc = atomic_load_explicit(&p_sys->sincos, memory_order_relaxed);
119
 
120
     for( int i_line = 0; i_line < i_visible_lines; i_line++ )
121
     {
122
@@ -412,11 +394,11 @@
123
             int i_col_orig;
124
             /* Handle "1st Y", U and V */
125
             i_line_orig = i_line_center +
126
-                ( ( i_sin * ( i_col - i_col_center )
127
-                  + i_cos * ( i_line - i_line_center ) )>>12 );
128
+                ( ( sc.sin * ( i_col - i_col_center )
129
+                  + sc.cos * ( i_line - i_line_center ) )>>12 );
130
             i_col_orig = i_col_center +
131
-                ( ( i_cos * ( i_col - i_col_center )
132
-                  - i_sin * ( i_line - i_line_center ) )>>12 );
133
+                ( ( sc.cos * ( i_col - i_col_center )
134
+                  - sc.sin * ( i_line - i_line_center ) )>>12 );
135
             if( 0 <= i_col_orig && i_col_orig < i_visible_pitch
136
              && 0 <= i_line_orig && i_line_orig < i_visible_lines )
137
             {
138
@@ -438,11 +420,11 @@
139
                 break;
140
 
141
             i_line_orig = i_line_center +
142
-                ( ( i_sin * ( i_col - i_col_center )
143
-                  + i_cos * ( i_line - i_line_center ) )>>12 );
144
+                ( ( sc.sin * ( i_col - i_col_center )
145
+                  + sc.cos * ( i_line - i_line_center ) )>>12 );
146
             i_col_orig = i_col_center +
147
-                ( ( i_cos * ( i_col - i_col_center )
148
-                  - i_sin * ( i_line - i_line_center ) )>>12 );
149
+                ( ( sc.cos * ( i_col - i_col_center )
150
+                  - sc.sin * ( i_line - i_line_center ) )>>12 );
151
             if( 0 <= i_col_orig && i_col_orig < i_visible_pitch
152
              && 0 <= i_line_orig && i_line_orig < i_visible_lines )
153
             {
154
_service:obs_scm:vlc-beta-20220206.71a389dfe1.obscpio/modules/video_output/opengl/filter_mock.c -> _service:obs_scm:vlc-beta-20220209.5820200442.obscpio/modules/video_output/opengl/filter_mock.c Changed
16
 
1
@@ -619,8 +619,13 @@
2
     set_callback_opengl_filter(Open)
3
     add_shortcut("mock");
4
     add_float(MOCK_CFG_PREFIX "angle", 0.f, NULL, NULL) /* in degrees */
5
+        change_volatile()
6
     add_float(MOCK_CFG_PREFIX "speed", 0.f, NULL, NULL) /* in rotations per minute */
7
+        change_volatile()
8
     add_bool(MOCK_CFG_PREFIX "mask", false, NULL, NULL)
9
+        change_volatile()
10
     add_bool(MOCK_CFG_PREFIX "plane", false, NULL, NULL)
11
-    add_integer(MOCK_CFG_PREFIX "msaa", 4, NULL, NULL);
12
+        change_volatile()
13
+    add_integer(MOCK_CFG_PREFIX "msaa", 4, NULL, NULL)
14
+        change_volatile()
15
 vlc_module_end()
16
_service:obs_scm:vlc-beta.obsinfo Changed
10
 
1
@@ -1,5 +1,5 @@
2
 name: vlc-beta
3
-version: 20220206.71a389dfe1
4
-mtime: 1644158970
5
-commit: 71a389dfe146bb5dc14c192a91296ed9ebd3573f
6
+version: 20220209.5820200442
7
+mtime: 1644392208
8
+commit: 58202004426ce9ac2d8e32ede722a3353a5cbad1
9
 
10