Linux light master control synchronous playing method and device
By generating packaged signals and managing timestamps and frame sequence numbers, the problem of wrong frames during synchronous playback in Linux lighting master system is solved, and high-precision synchronous playback is achieved, improving the quality of lighting effects and the stability of the system.
Patent Information
- Application Number
- CN202411599759.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-11-11
AI Technical Summary
In Linux systems, since the lighting master is not a hard real-time system, there is an uncontrollable delay in thread scheduling, resulting in errors in frames during synchronous playback, seriously affecting the performance effect.
By generating packaged signals, using NMEA information and pulse signals for timestamp recording and interval analysis, filtering appropriate playback timestamps, and performing timing processing and frame sequence management, calculating compensation time, generating frame sequence numbers, and finally synchronous playback is performed according to the multi-frame buffer pipeline strategy.
It realizes high-precision synchronous playback of multiple Linux light masters, improves the quality and reliability of the overall lighting effect, avoids the phenomenon of wrong frames, and enhances the stability and reliability of the system.
Smart Images

Figure CN119562419A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of audio control, and in particular to a Linux lighting master control synchronous playback method and device. Background Art
[0002] In floodlighting control systems, in order to achieve the overall joint control of lights in a larger area, it is often necessary to equip multiple lighting master controllers, and the lighting master controllers must be synchronized when playing lighting effects. Limited by physical wiring and cost, more occasions choose to use GPS satellite timing for synchronization. At the same time, the functions of lighting master controllers are becoming increasingly rich, and they need to run complex tasks including operation interaction, network communication, video decoding, image processing, wiring mapping, data construction and transmission. Based on stability and software development environment requirements, application development is generally based on the Linux system. Although Linux performs well in terms of performance, it is not a hard real-time system and there are uncontrollable delays in thread scheduling. When facing application scenarios with high real-time requirements such as synchronous playback, if certain measures are not taken to ensure real-time synchronization, the performance may present a phenomenon of frame errors that can be distinguished by the human eye (a frame of an image from a different master controller is displayed at different times), which will seriously affect the performance effect. Summary of the invention
[0003] The embodiment of the present invention provides a Linux lighting master controller synchronous playback method and device, which realizes high-precision synchronous playback of multiple Linux lighting master controllers, thereby improving the quality and reliability of the overall lighting effect.
[0004] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application provides a Linux lighting master control synchronous playback, including:
[0005] Generate several groups of packaged signals according to NMEA information and pulse signals;
[0006] receiving a plurality of groups of encapsulated signals, and recording a group of timestamps in each group of encapsulated signals and a plurality of groups of timestamp intervals between adjacent groups of encapsulated signals;
[0007] If the intervals of a number of consecutive timestamps that are not less than a preset number are all within a preset range, the timestamp corresponding to the interval of the last timestamp is taken as the playback timestamp;
[0008] Performing timing processing and frame sequence management on the playback timestamp in sequence, and obtaining compensation time according to the start time of the timing processing and the start time of the frame sequence management;
[0009] Generate a frame number of a Linux lighting master control frame according to the playback timestamp and the compensation time;
[0010] According to the multi-frame buffer pipeline strategy and the frame sequence number, the Linux lighting master frame is selected for synchronous playback.
[0011] In a possible implementation manner of the first aspect, generating several groups of packaged signals according to the NMEA information and the pulse signal specifically includes:
[0012] Extract the timestamp and signal quality information from the NMEA information;
[0013] Recording the initial time when the pulse signal is received and the offset timing is started, and obtaining the offset delay according to the time difference between the preselected sending time and the initial time;
[0014] The timestamp, signal quality information and the offset delay are encapsulated to generate several groups of encapsulated signals and the several groups of encapsulated signals are sent to the Linux lighting master control at the sending time.
[0015] In a possible implementation manner of the first aspect, encapsulating the timestamp, the signal quality information, and the offset value to generate several groups of encapsulated signals specifically includes:
[0016] A preset identification field, a year field extracted from the timestamp, a month field extracted from the timestamp, a day field extracted from the timestamp, an hour field extracted from the timestamp, a minute field extracted from the timestamp, a second field extracted from the timestamp, the offset value, the number of satellites and a check value are encapsulated to generate a set of encapsulated signals; the check value is the byte size accumulation value of other fields except the identification field and the check value field.
[0017] In a possible implementation manner of the first aspect, if a plurality of consecutive groups of time stamp intervals that are not less than a preset number are within a preset range, before taking a timestamp corresponding to a last group of time stamp intervals as a playback timestamp, the method further includes:
[0018] Obtain several groups of timestamps sent from the MCU to the Linux lighting master control in the historical data as a historical timestamp set;
[0019] A normal distribution analysis is performed on the historical timestamp set, and a preset range is determined according to the analysis result.
[0020] In a possible implementation manner of the first aspect, performing a normal distribution analysis on the historical timestamp set and determining a preset range according to the analysis result specifically includes:
[0021] Counting the value range of the historical timestamp set, and dividing the value range into a plurality of value intervals according to a preset interval interval;
[0022] Count the number and proportion of timestamps corresponding to several of the value intervals, perform normal distribution analysis based on the average value of the historical timestamp set, and determine two value intervals according to the preset sample concentration ratio;
[0023] The preset range is determined according to the two value intervals.
[0024] In a possible implementation manner of the first aspect, sequentially performing timing processing and frame sequence management on the playback timestamp, and obtaining the compensation time according to the start time of the timing processing and the start time of the frame sequence management, specifically includes:
[0025] The playback timestamp is sequentially subjected to timing processing and frame sequence management, and the time difference between the start time of the frame sequence management and the start time of the timing processing is used as the compensation time.
[0026] In a possible implementation manner of the first aspect, generating a frame number of a Linux light master control frame according to the playback timestamp and the compensation time specifically includes:
[0027] Taking the time difference between the playback timestamp and the preset comparison time as an offset value;
[0028] A division operation and a remainder operation are performed on the sum of the offset value, the offset delay and the compensation time to obtain a frame number of the Linux lighting master control frame.
[0029] In a possible implementation manner of the first aspect, before receiving the plurality of groups of encapsulated signals and recording a group of timestamps in each group of the encapsulated signals and a plurality of groups of timestamp intervals between adjacent groups of the encapsulated signals, the method further includes:
[0030] Allocate CPU cores, set scheduling strategies and priorities for timing processing threads, frame sequence management threads, video decoding threads, image processing threads, mapping processing threads, number sending threads, logic control threads and other threads respectively; there are several CPU cores; the scheduling strategies include first-in-first-out strategies, polling scheduling strategies and other strategies;
[0031] The priority of the timing processing thread, the frame sequence management thread and the number transmission thread is the highest priority; the priority of the video decoding thread, the image processing thread and the mapping processing thread is the second highest priority; the priority of the logic control thread is the lowest priority; the priority of the other threads is a custom priority.
[0032] In a possible implementation manner of the first aspect, the multi-frame buffer pipeline strategy specifically includes:
[0033] Set the number of buffered frames;
[0034] According to the number of thread types involved in selecting the Linux light master frame for synchronous playback, several pipeline levels are set; a pipeline level is set between every two threads of different types.
[0035] A second aspect of an embodiment of the present application provides a Linux lighting master control synchronous playback device, comprising:
[0036] The MCU encapsulation module is used to generate several groups of encapsulation signals according to the NMEA information and pulse signals;
[0037] A main control recording module, used for receiving a plurality of groups of packaged signals, recording a group of timestamps in each group of packaged signals and a plurality of groups of timestamp intervals between adjacent groups of packaged signals;
[0038] A master control timestamp module, used for taking the timestamp corresponding to the last group of timestamp intervals as the playback timestamp if the intervals of a number of consecutive timestamps not less than a preset number are all within a preset range;
[0039] A main control compensation module, used to perform timing processing and frame sequence management on the playback timestamp in sequence, and obtain compensation time according to the start time of the timing processing and the start time of the frame sequence management;
[0040] A master control frame sequence number module, used to generate a frame sequence number of a Linux lighting master control frame according to the play timestamp and the compensation time;
[0041] The master control playback module is used to select the Linux lighting master control frame for synchronous playback according to the multi-frame buffer pipeline strategy and the frame sequence number.
[0042] Compared with the prior art, the embodiments of the present invention provide a Linux lighting master controller synchronous playback method and device, which generate a packaged signal according to NMEA information and a pulse signal for subsequent time synchronization and data transmission; receive the packaged signal and record the timestamp and its interval for subsequent time synchronization analysis; screen the appropriate playback timestamp by the timestamp interval to ensure the accuracy of time synchronization; perform timing processing and frame sequence management on the playback timestamp, calculate the compensation time, and ensure high-precision synchronization of the playback; generate a frame number according to the playback timestamp and the compensation time for subsequent frame selection and playback; finally, select a frame for playback according to the multi-frame buffer pipeline strategy and the frame number to ensure the playback synchronization of all lighting master controllers.
[0043] Through the above steps and technical means, high-precision synchronous playback of multiple lighting master controllers can be achieved on the Linux system. This method not only improves the stability and reliability of the playback system, but also enables the synchronous control of complex lighting effects within the constraints of cost and physical wiring. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a flowchart of a Linux lighting master control synchronous playback method provided by an embodiment of the present invention;
[0045] Figure 2 It is a schematic diagram of a confirmation process of a preset range provided by an embodiment of the present invention;
[0046] Figure 3 is a schematic diagram of a process of providing a compensation time calculation method according to an embodiment of the present invention;
[0047] Figure 4 is a schematic diagram of a multi-frame buffer pipeline strategy provided by an embodiment of the present invention;
[0048] Figure 5 The present invention is a schematic diagram of a Linux lighting master control synchronous playback device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] To solve the above problems, see Figure 1 An embodiment of the present invention provides a Linux lighting master control synchronous playback, including:
[0051] S10. Generate several groups of packaged signals according to the NMEA information and the pulse signal.
[0052] S11. Receive several groups of packaged signals, and record a group of timestamps in each group of packaged signals and several groups of timestamp intervals between adjacent groups of packaged signals.
[0053] S12: If the intervals of a plurality of consecutive timestamp groups that are not less than a preset number are all within a preset range, taking the timestamp corresponding to the interval of the last timestamp group as the playback timestamp.
[0054] S13, performing timing processing and frame sequence management on the playback timestamp in sequence, and obtaining compensation time according to the start time of the timing processing and the start time of the frame sequence management.
[0055] S14. Generate a frame number of a Linux light master control frame according to the play timestamp and the compensation time.
[0056] S15. According to the multi-frame buffer pipeline strategy and the frame sequence number, the Linux lighting master control frame is selected for synchronous playback.
[0057] S10 generates a packaged signal containing a timestamp and related data for subsequent time synchronization and data transmission; S11 receives the packaged signal and records the timestamp and its interval for subsequent time synchronization and playback; S13 performs timing processing and frame sequence management on the playback timestamp, calculates the compensation time, and ensures high-precision synchronization of the master control playback; S14 generates a frame number based on the playback timestamp and compensation time for subsequent frame selection and playback; S15 selects frames for synchronous playback based on the multi-frame buffer pipeline strategy and frame number to ensure playback synchronization of all lighting master controllers.
[0058] In practical applications, an MCU (single-chip microcomputer with good real-time performance) can be added between the GPS module and the SOC (Linux lighting master, equivalent to running Linux) to capture the PPS (high-precision integer second pulse) signal, generate an interrupt on its rising edge and start the offset timing accurate to 1ms. When the MCU receives the NMEA information, it extracts the timestamp and satellite quantity (signal quality) information, and obtains the offset value of the timestamp in the NEMA information relative to the initial moment (the initial moment is the moment when the MCU receives the pulse signal and starts the offset timing). The three types of information are packaged together into a fixed-byte information packet and sent to the SOC through the UART serial port. After this, there is no need to change the Linux kernel. The deviation of R1 between different devices is the MCU processing deviation. The MCU has no other processing tasks, and the general deviation can be controlled below 1us. It should be noted that R1 refers to the time deviation sent by the timestamp of the source GPS module.
[0059] The above solution can improve the time synchronization accuracy between multiple lighting controllers, which is particularly important for lighting performances that require high coordination. Moreover, by optimizing the time synchronization mechanism and thread management strategy, the overall stability and reliability of the playback system are enhanced. In addition, software algorithms are used to achieve high-precision time synchronization, reducing the dependence on external high-precision clock sources and reducing the hardware cost of the system. Due to the support of multi-frame buffer pipeline strategy, the system has good flexibility and scalability, and can adapt to the needs of lighting control systems of different scales and complexities.
[0060] Exemplarily, the generating of several groups of packaged signals according to the NMEA information and the pulse signal specifically includes:
[0061] Extract the timestamp and signal quality information from the NMEA information;
[0062] Recording the initial time when the pulse signal is received and the offset timing is started, and obtaining the offset delay according to the time difference between the preselected sending time and the initial time;
[0063] The timestamp, signal quality information and the offset delay are encapsulated to generate several groups of encapsulated signals and the several groups of encapsulated signals are sent to the Linux lighting master control at the sending time.
[0064] The above steps can be run by MCU, and MCU finally sends the encapsulated data packet to SOC (Linux lighting master control) through UART serial port. The specific composition of the encapsulated signal can be seen in Table 1, where the check value calculates the byte sum of multiple fields in the encapsulated signal to ensure that the data is not lost or damaged during the transmission process. If the check value calculated by the receiver does not match the check value sent by the sender, it means that an error has occurred in the data transmission process. This ensures that the generated data packet maintains integrity and correctness during the transmission process. The use of the check value greatly improves the reliability of data transmission.
[0065] Through the above steps, several groups of packaged signals can be generated according to NMEA information and pulse signals, and these signals can be sent to the Linux lighting master at the pre-selected sending time. This can ensure the accuracy of time synchronization and the reliability of the system.
[0066] Table 1 Composition of package signals
[0067]
[0068] Exemplarily, encapsulating the timestamp, the signal quality information, and the offset value to generate several groups of encapsulated signals specifically includes:
[0069] A preset identification field, a year field extracted from the timestamp, a month field extracted from the timestamp, a day field extracted from the timestamp, an hour field extracted from the timestamp, a minute field extracted from the timestamp, a second field extracted from the timestamp, the offset value, the number of satellites and a check value are encapsulated to generate a set of encapsulated signals; the check value is the byte size accumulation value of other fields except the identification field and the check value field.
[0070] The generation process of the encapsulated signal can be summarized as follows: extract the year, month, day, hour, minute, and second fields from the timestamp. Calculate the time difference between the timestamp and the initial time and convert it to milliseconds. Calculate the byte accumulation value of all fields except the identification and check value, and use the result as the check value. Finally, encapsulate all fields into a binary data packet according to the format of Table 1.
[0071] Through these steps, high-precision time synchronization can be achieved, ensuring that the time deviation between different devices is controlled at the microsecond level. This method does not require changes to the Linux kernel, and takes advantage of the real-time performance of the MCU to achieve efficient synchronization control.
[0072] Exemplarily, if the intervals of a plurality of consecutive timestamp groups not less than a preset number are all within a preset range, before taking the timestamp corresponding to the interval of the last timestamp group as the playback timestamp, the method further includes:
[0073] Obtain several groups of timestamps sent from the MCU to the Linux lighting master control in the historical data as a historical timestamp set;
[0074] A normal distribution analysis is performed on the historical timestamp set, and a preset range is determined according to the analysis result.
[0075] Ideally, the interval between each group should be 1000ms (milliseconds). In reality, due to the response of the playback system, there is a fluctuation of -8ms to 10ms, and the average value may be 1000.28ms. In order to eliminate the impact of this fluctuation, according to Figure 2 The normal distribution analysis results take ±4ms to determine the preset range and then filter the samples according to the preset range. When the intervals of 5 consecutive timestamps are within the preset range of 1000±4ms, the latest timestamp is adopted for application. It should be noted that the calculated sample average is 1000.28ms, which is only 0.28ms away from the ideal value of 1000ms, indicating that the interval time has good complementarity.
[0076] Through these steps, the accuracy and stability of timestamps can be ensured, and the reliability of time synchronization can be improved. This method utilizes the statistical characteristics of historical data and effectively filters out abnormal timestamp intervals.
[0077] Exemplarily, performing normal distribution analysis on the historical timestamp set and determining a preset range according to the analysis result specifically includes:
[0078] Counting the value range of the historical timestamp set, and dividing the value range into a plurality of value intervals according to a preset interval interval;
[0079] Count the number and proportion of timestamps corresponding to several of the value intervals, perform normal distribution analysis based on the average value of the historical timestamp set, and determine two value intervals according to the preset sample concentration ratio;
[0080] The preset range is determined according to the two value intervals.
[0081] When performing normal distribution analysis, you can obtain the minimum and maximum values of the timestamp interval. Divide the value range into several value intervals according to the preset interval interval. Count the number of timestamps in each value interval and calculate its proportion to the total number of timestamps. Calculate the mean and standard deviation of the timestamp interval. Finally, determine two value intervals based on the confidence level as the boundaries of the preset range.
[0082] In practical applications, Figure 2 For example, we can use the historical timestamp set as samples, and then divide the sample value range into 20 intervals at 1ms intervals. We count the number of samples in the 20 intervals and their proportions, and we get that 99.5% of the samples are concentrated in the 996-1004ms interval (within the range of 1000±4ms, visual persistence effect, does not affect the synchronization of lights between devices), while a few large fluctuations are outside this interval and are discretely distributed. It can be observed from the samples that mutations (more than 4ms) are generally 2 to 4 adjacent samples, which are non-continuous, so 5 groups of samples can be selected for filtering operations (all 5 groups are stable data, and the last group is used because this moment in the program is closest to the timestamp).
[0083] See also Figure 3 Exemplarily, the performing timing processing and frame sequence management on the playback timestamp in sequence, and obtaining the compensation time according to the start time of the timing processing and the start time of the frame sequence management, specifically includes:
[0084] The playback timestamp is sequentially subjected to timing processing and frame sequence management, and the time difference between the start time of the frame sequence management and the start time of the timing processing is used as the compensation time.
[0085] A software response compensation strategy is further adopted for the transmission of timestamps between system threads. The compensation timing accurate to 1ms is started from the time the system receives the external timestamp, and compensation is performed when the timestamp is finally applied to eliminate this part of the delay difference. The timestamp is processed by the timing processing thread and passed to the frame sequence management thread for application. The frame sequence management thread converts the timestamp into an offset time relative to 0:0:0:00 on January 1, 2000 (or other preset reference time), and adds the compensation time Td, which can be used to calculate the frame number of the final output lighting effect.
[0086] Through these steps, the accuracy and stability of the timestamp can be ensured, and the reliability of time synchronization can be improved. This method uses the statistical characteristics of historical data to effectively filter out abnormal timestamp intervals, and calculates compensation time through timing processing and frame sequence management, further improving the accuracy of the system.
[0087] Exemplarily, generating a frame number of a Linux light master control frame according to the play timestamp and the compensation time specifically includes:
[0088] Taking the time difference between the playback timestamp and the preset comparison time as an offset value;
[0089] A division operation and a remainder operation are performed on the sum of the offset value, the offset delay and the compensation time to obtain a frame number of the Linux lighting master control frame.
[0090] When a pulse signal is received and offset timing starts, the initial time is recorded. This initial time can be a fixed time point when the MCU is started, or a time point recorded every time the MCU receives a pulse signal.
[0091] When the Linux lighting master control (SOC) receives the playback timestamp, it records the current time (sending time). The Linux lighting master control calculates the time difference between the sending time and the initial time, and this time difference is the offset delay. Add the offset value To, the offset delay Tc and the compensation time Td to get a total offset time. Perform division and remainder operations on this total offset time to get the frame number of the Linux lighting master control frame.
[0092] For a more specific calculation process, please refer to the following example:
[0093] 1. Get the playback timestamp (consisting of year, month, day, hour, minute, and second, output once per second) Ti;
[0094] 2. Convert the playback timestamp into the offset value To relative to 0:0:0:0 on January 1, 2000, in milliseconds;
[0095] 3. Get the current playback frame rate Fs (indicates how long it takes to send a frame, in milliseconds / frame) and the total number of frames of the lighting effect Fq;
[0096] 4. Calculate the frame number Fn played at the current moment by "Fn = ((To + Tc + Td) / Fs) % Fq" ( / is the division sign, % is the remainder); (Tc is the offset delay from the GPS sending the playback timestamp to the software capturing it, in milliseconds; Td is the compensation time from capturing the playback timestamp to starting to calculate the frame sequence, in milliseconds).
[0097] 5. Read the light effect frame with frame number Fn for playback. (When the master controller selects the effect frame for playback, it needs to go through steps such as video decoding, image processing, wiring mapping, data packet sending, etc., and there is an uncertain delay Ts (unit: ms)).
[0098] Through the above steps, the frame number of the Linux lighting master frame can be generated according to the playback timestamp and compensation time. This method ensures the accuracy of time synchronization and can effectively manage the frame number, thereby improving the stability and reliability of the system.
[0099] Exemplarily, before receiving several groups of the encapsulated signals and recording a group of timestamps in each group of the encapsulated signals and several groups of timestamp intervals between adjacent groups of the encapsulated signals, the method further includes:
[0100] Allocate CPU cores, set scheduling strategies and priorities for timing processing threads, frame sequence management threads, video decoding threads, image processing threads, mapping processing threads, number sending threads, logic control threads and other threads respectively; there are several CPU cores; the scheduling strategies include first-in-first-out strategies, polling scheduling strategies and other strategies;
[0101] The priority of the timing processing thread, the frame sequence management thread and the number transmission thread is the highest priority; the priority of the video decoding thread, the image processing thread and the mapping processing thread is the second highest priority; the priority of the logic control thread is the lowest priority; the priority of the other threads is a custom priority.
[0102] Most current SOC solutions (Linux lighting master or running Linux system) are multi-core CPUs. Binding key threads to CPU cores and setting thread scheduling strategies and priorities can effectively reduce the uncertainty of thread response delays. For example, in the lighting master in this case, the SOC can use RK3328 (quad-core CPU), and the playback software is mainly composed of timing processing threads, frame sequence management threads, video decoding threads, image processing threads, number transmission threads, logic control threads and other threads. The priority strategy is shown in Table 2. Combined with other strategies in this method, a good synchronous playback effect can be achieved.
[0103] In Table 2, a larger priority value represents a higher priority, with 99 being the highest; SCHED_FIFO is a first-in-first-out (FIFO) scheduling strategy, SCHED_RR is a round-robin scheduling strategy, and SCHED_OTHER is other scheduling strategies (usually the default scheduling strategy).
[0104] Table 2 Critical thread priority strategy
[0105]
[0106] On the one hand, the above steps reasonably set the thread priority and scheduling strategy to ensure that the key thread can be executed in time: use SCHED_FIFO or SCHED_RR scheduling strategy and set a higher priority; use SCHED_OTHER scheduling strategy and set a lower priority. On the other hand, the above steps bind the key thread to a specific CPU core, reduce the delay caused by thread switching between different cores, reduce the response time deviation of the Linux lighting master application layer program, obtain a more accurate compensation time Td, and improve the real-time performance and stability of the system.
[0107] In other words, through the above steps, it is possible to ensure that different threads run efficiently on a multi-core CPU, and that key threads have the highest priority, thereby improving system performance and stability and achieving good synchronous playback effects. This method is particularly suitable for application scenarios that require high real-time performance and low latency, such as a playback system composed of Linux lighting master controls.
[0108] See also Figure 4 , exemplarily, the multi-frame buffer pipeline strategy specifically includes:
[0109] Set the number of buffered frames;
[0110] According to the number of thread types involved in selecting the Linux light master frame for synchronous playback, several pipeline levels are set; a pipeline level is set between every two threads of different types.
[0111] Different Linux lighting masters in the playback system can generate consistent frame numbers at relatively consistent times. However, from the generation of the frame number to the display of the lighting effect, it is still necessary to go through processes that require a lot of calculations, such as video decoding, image processing, mapping processing, and data sending. If single-frame sequential processing is used, the time occupied by each process will fluctuate due to the uncertainty of system task scheduling, which may result in uneven playback (i.e., fluctuations in frame intervals lead to uneven effects). When multi-frame buffer pipeline processing is used, the uncertainty of the time taken by each process can be controlled, so that the reserved time for the number-generating process is more sufficient, which can effectively suppress uneven playback. In the Linux lighting master control involved in this case, 10-frame buffer processing and 3-level pipeline processing can be used.
[0112] 10 frames is an empirical value, which can be changed in different playback systems according to resources and performance. In this example, buffering 10 frames is actually measured to offset the fluctuations caused by thread scheduling and resource preemption, and the time required to buffer 10 frames during pre-playback is acceptable to the system application (200-600ms);
[0113] 3-stage pipeline Figure 4As shown, video decoding to image processing is the first level, image processing to mapping processing is the second level, and mapping processing to sending data is the third level. The four processing steps have a sequence and each occupies a certain amount of CPU usage (in this example, a single step occupies about 20-90% of a single-core CPU). In this example, the CPU has 4 cores, divided into a 3-level pipeline. Each core can execute 4 processing steps concurrently to form a pipeline to avoid instability caused by resource congestion.
[0114] Through the above steps, a multi-frame buffer pipeline strategy can be implemented to reduce the response time deviation of the Linux lighting master control application layer program and improve the real-time performance and stability of the system.
[0115] Compared with the prior art, an embodiment of the present invention provides a Linux lighting master controller synchronous playback method, which generates a packaged signal according to NMEA information and a pulse signal for subsequent time synchronization and data transmission; receives the packaged signal and records the timestamp and its interval for subsequent time synchronization analysis; selects a suitable playback timestamp by the timestamp interval to ensure the accuracy of time synchronization; performs timing processing and frame sequence management on the playback timestamp, calculates the compensation time, and ensures high-precision synchronization of playback; generates a frame number according to the playback timestamp and the compensation time, which is used for subsequent frame selection and playback; finally, selects a frame for playback according to the multi-frame buffer pipeline strategy and the frame number, and ensures the playback synchronization of all lighting master controllers.
[0116] Through the above steps and technical means, high-precision synchronous playback of multiple lighting master controllers can be achieved on the Linux system. This method not only improves the stability and reliability of the playback system, but also enables the synchronous control of complex lighting effects within the constraints of cost and physical wiring.
[0117] The embodiment of the present application provides a Linux lighting master control synchronous playback device, including an MCU encapsulation module, a master control recording module, a master control timestamp module, a master control compensation module, a master control frame sequence number module and a master control playback module. Figure 5 In actual applications, you can choose to place the MCU encapsulation module in the MCU, and place the master recording module, master timestamp module, master compensation module, master frame number module and master playback module in the SOC (which can run Linux). The SOC here is a Linux lighting master control.
[0118] The MCU encapsulation module is used to generate several groups of encapsulated signals according to the NMEA information and pulse signals.
[0119] The main control recording module is used to receive several groups of packaged signals, record a group of timestamps in each group of packaged signals and several groups of timestamp intervals between adjacent groups of packaged signals.
[0120] The master control timestamp module is used to take the timestamp corresponding to the last group of timestamp intervals as the playback timestamp if a number of consecutive timestamp intervals that are not less than a preset number are all within a preset range.
[0121] The main control compensation module is used to perform timing processing and frame sequence management on the playback time stamp in sequence, and obtain the compensation time according to the start time of the timing processing and the start time of the frame sequence management.
[0122] The master control frame sequence number module is used to generate a frame sequence number of the Linux lighting master control frame according to the play timestamp and the compensation time.
[0123] The master control playback module is used to select the Linux lighting master control frame for synchronous playback according to the multi-frame buffer pipeline strategy and the frame sequence number.
[0124] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be described again here.
[0125] Compared with the prior art, an embodiment of the present invention provides a Linux lighting master control synchronous playback device, which generates a packaged signal according to NMEA information and a pulse signal for subsequent time synchronization and data transmission; receives the packaged signal and records the timestamp and its interval for subsequent time synchronization analysis; selects a suitable playback timestamp by the timestamp interval to ensure the accuracy of time synchronization; performs timing processing and frame sequence management on the playback timestamp, calculates the compensation time, and ensures high-precision synchronization of playback; generates a frame number according to the playback timestamp and the compensation time, which is used for subsequent frame selection and playback; finally, selects a frame for playback according to the multi-frame buffer pipeline strategy and the frame number, and ensures the playback synchronization of all lighting master controllers.
[0126] Through the above steps and technical means, high-precision synchronous playback of multiple lighting master controllers can be achieved on the Linux system. This method not only improves the stability and reliability of the playback system, but also enables the synchronous control of complex lighting effects within the constraints of cost and physical wiring.
[0127] An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute a Linux lighting master control synchronous playback method as described above.
[0128] The computer device may be a computing device such as a smart phone, a tablet computer, a desktop computer, and a cloud server. The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the figure is merely an example of a computer device and does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different components, such as input and output devices, network access devices, etc.
[0129] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0130] In some embodiments, the memory may be an internal storage unit of the computer device, such as a hard disk or memory of the computer device. In other embodiments, the memory may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Further, the memory may also include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory may also be used to temporarily store data that has been output or is to be output.
[0131] An embodiment of the present application provides a computer program product. When the computer program product is run on a computer device, the computer device implements the steps in the above-mentioned method embodiments when executing the computer device.
[0132] In several embodiments provided in the present application, it is understood that each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved.
[0133] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0134] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A Linux lighting master control synchronous playback method, characterized in that: include: Generate several groups of packaged signals according to NMEA information and pulse signals; receiving a plurality of groups of encapsulated signals, and recording a group of timestamps in each group of encapsulated signals and a plurality of groups of timestamp intervals between adjacent groups of encapsulated signals; If the intervals of a number of consecutive timestamps that are not less than a preset number are all within a preset range, the timestamp corresponding to the interval of the last timestamp is taken as the playback timestamp; Performing timing processing and frame sequence management on the playback timestamp in sequence, and obtaining compensation time according to the start time of the timing processing and the start time of the frame sequence management; Generate a frame number of a Linux lighting master control frame according to the playback timestamp and the compensation time; According to the multi-frame buffer pipeline strategy and the frame sequence number, the Linux lighting master frame is selected for synchronous playback.
2. A Linux lighting master control synchronous playback method as claimed in claim 1, characterized in that: The method of generating several groups of packaged signals according to the NMEA information and the pulse signal specifically includes: Extract the timestamp and signal quality information from the NMEA information; Recording the initial time when the pulse signal is received and the offset timing is started, and obtaining the offset delay according to the time difference between the preselected sending time and the initial time; The timestamp, signal quality information and the offset delay are encapsulated to generate several groups of encapsulated signals and the several groups of encapsulated signals are sent to the Linux lighting master control at the sending time.
3. A Linux lighting master control synchronous playback method as claimed in claim 2, characterized in that: The encapsulating the timestamp, the signal quality information and the offset value to generate a plurality of groups of encapsulated signals specifically includes: A preset identification field, a year field extracted from the timestamp, a month field extracted from the timestamp, a day field extracted from the timestamp, an hour field extracted from the timestamp, a minute field extracted from the timestamp, a second field extracted from the timestamp, the offset value, the number of satellites and a check value are encapsulated to generate a set of encapsulated signals; the check value is the byte size accumulation value of other fields except the identification field and the check value field.
4. A Linux lighting master control synchronous playback method as claimed in claim 1, characterized in that: If the intervals of a plurality of consecutive timestamp groups not less than a preset number are all within a preset range, taking the timestamp corresponding to the interval of the last timestamp group as the playback timestamp, the method further includes: Obtain several groups of timestamps sent from the MCU to the Linux lighting master control in the historical data as a historical timestamp set; A normal distribution analysis is performed on the historical timestamp set, and a preset range is determined according to the analysis result.
5. A Linux lighting master control synchronous playback method as claimed in claim 4, characterized in that: The performing normal distribution analysis on the historical timestamp set and determining the preset range according to the analysis result specifically includes: Counting the value range of the historical timestamp set, and dividing the value range into a plurality of value intervals according to a preset interval interval; Count the number and proportion of timestamps corresponding to several of the value intervals, perform normal distribution analysis based on the average value of the historical timestamp set, and determine two value intervals according to the preset sample concentration ratio; The preset range is determined according to the two value intervals.
6. A Linux lighting master control synchronous playback method as claimed in claim 1, characterized in that: The timing processing and frame sequence management are sequentially performed on the playback timestamp, and the compensation time is obtained according to the start time of the timing processing and the start time of the frame sequence management, specifically including: The playback timestamp is sequentially subjected to timing processing and frame sequence management, and the time difference between the start time of the frame sequence management and the start time of the timing processing is used as the compensation time.
7. A Linux lighting master control synchronous playback method as claimed in claim 2, characterized in that: The generating the frame number of the Linux light master control frame according to the play timestamp and the compensation time specifically includes: Taking the time difference between the playback timestamp and the preset comparison time as an offset value; A division operation and a remainder operation are performed on the sum of the offset value, the offset delay and the compensation time to obtain a frame number of the Linux lighting master control frame.
8. A Linux lighting master control synchronous playback method as claimed in claim 1, characterized in that: Before receiving a plurality of groups of encapsulated signals and recording a group of timestamps in each group of encapsulated signals and a plurality of groups of timestamp intervals between adjacent groups of encapsulated signals, the method further includes: Allocate CPU cores, set scheduling strategies and priorities for timing processing threads, frame sequence management threads, video decoding threads, image processing threads, mapping processing threads, number sending threads, logic control threads and other threads respectively; there are several CPU cores; the scheduling strategies include first-in-first-out strategies, polling scheduling strategies and other strategies; The priority of the timing processing thread, the frame sequence management thread and the number transmission thread is the highest priority; the priority of the video decoding thread, the image processing thread and the mapping processing thread is the second highest priority; the priority of the logic control thread is the lowest priority; the priority of the other threads is a custom priority.
9. A Linux lighting master control synchronous playback method as claimed in claim 1, characterized in that: The multi-frame buffer pipeline strategy specifically includes: Set the number of buffered frames; According to the number of thread types involved in selecting the Linux light master frame for synchronous playback, several pipeline levels are set; a pipeline level is set between every two threads of different types.
10. A Linux lighting master control synchronous playback device, characterized in that: include: The MCU encapsulation module is used to generate several groups of encapsulation signals according to the NMEA information and pulse signals; A main control recording module, used for receiving a plurality of groups of packaged signals, recording a group of timestamps in each group of packaged signals and a plurality of groups of timestamp intervals between adjacent groups of packaged signals; A master control timestamp module, used for taking the timestamp corresponding to the last group of timestamp intervals as the playback timestamp if the intervals of a number of consecutive timestamps not less than a preset number are all within a preset range; A main control compensation module, used to perform timing processing and frame sequence management on the playback timestamp in sequence, and obtain compensation time according to the start time of the timing processing and the start time of the frame sequence management; A master control frame sequence number module, used to generate a frame sequence number of a Linux lighting master control frame according to the play timestamp and the compensation time; The master control playback module is used to select the Linux lighting master control frame for synchronous playback according to the multi-frame buffer pipeline strategy and the frame sequence number.
Citation Information
Patent Citations
Method and system for remotely and real-time playing and synchronously controlling light emitting diode (LED) lamp light
CN102186275A
Streaming media playing method based on frame alignment technology
CN103780977A
LED lamp time synchronization method
CN107819536A
Automobile electronic control unit signal synchronous acquisition method, electronic equipment, server and storage medium
CN111130674A
Audio synchronization method, audio playing device and storage medium
CN115549832A