Boundary Handling for Adaptive Loop Filtering

SA521430180B1Active Publication Date: 2024-08-28QUALCOMM INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
SA521430180
Authority / Receiving Office
SA · SA
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-08-29
Publication Date
2024-08-28
Estimated Expiration
2040-03-11

AI Technical Summary

Technical Problem

Existing video encoding and decoding techniques face challenges in accurately determining gradient values for samples near boundaries, leading to potential losses in subjective and objective quality due to the unavailability of neighboring samples outside the image, slice, or panel boundaries, which affects the effectiveness of amplitude loop filtering (ALF).

Method used

Implementing twin-loop filtering techniques that compute gradient values for boundary samples by replacing unavailable neighboring samples with values from the nearest available samples within the image, slice, or panel, thereby improving the accuracy of ALF operations.

Benefits of technology

Enhances the subjective and objective quality of filtered video samples by accurately determining gradient values at boundaries, thus improving the overall quality of reconstructed video segments.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

A video encoder and / or video decoder are configured to apply an adaptive loop filter to a reconstructed block of video data. The video encoder and / or video decoder may be configured to determine a value of a gradient for a sample in the reconstructed block of video data, including performing a gradient calculation for the sample using an available sample that corresponds to an unavailable sample that is outside of one of: a picture, a slice, a tile, or a tile group that includes the reconstructed block of samples, determine an adaptive loop filter for the reconstructed block of video data based at least in part on the determined value of the gradient for the sample, and apply the determined adaptive loop filter to the reconstructed block of video data to generate a filtered block of video data. Fig 2.
Need to check novelty before this filing date? Find Prior Art

Description

<h2 style=";text-align:left;direction:ltr">Full description<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Background of the invention<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> This disclosure relates to video encoding and video decoding.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Digital video capabilities can be integrated into a wide range of devices, including digital televisions and digital direct broadcasting systems, wireless broadcasting systems, personal digital assistants (PDAs), laptop or desktop computers, tablet computers, e-book readers, digital cameras, digital recorders, digital media players, video game consoles, video game consoles, cellular or satellite phones, so-called "smartphones," video teleconferencing devices, video streaming devices, and the like. Digital video devices implement video programming technologies, such as those described in the standards defined by MPEG-2, MPEG-4, ITU-T H.263, ITU-T H.264 / MPEG-4 Part 10, Advanced Video Programming (AVC), ITU-T H.265 / High Efficiency Video Programming (HEVC), and extensions to those standards.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Video devices may transmit, receive, encode, decode and / or store digital video information more efficiently by implementing these video programming technologies.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Video programming techniques involve spatial prediction (within a picture) and / or temporal prediction (between pictures) to reduce or eliminate redundancy in a video sequence. For segment-based video programming, a video segment (e.g., a video image or a portion of a video image) may be divided into video segments, which may also be referred to as programming tree units (CTUs), programming units (CUs), and / or programming nodes. Video segments in an intercoded (I) image segment are encoded using spatial prediction relative to reference samples in adjacent segments in the same picture. Video segments in an intercoded (P or B) image segment may use spatial prediction relative to reference samples in adjacent segments in the same picture or temporal prediction relative to reference samples in other reference images. Images may be referred to as frames, and reference images may be referred to as reference frames.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> General description of the invention<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In general, this disclosure describes techniques for user-specific filters in video programming. In particular, when performing ALF on a clip of samples near the boundary of an image, slide, panel, or group of panels, not all samples used to perform ALF may be available. In one example, samples used to determine the gradient value of a sample near a boundary may not be available if those samples are outside the boundary. In another example, gradient values ​​within a window around a sampled clip used to determine gradients and / or other information for performing ALF on the clip may not be available. This disclosure describes techniques for determining those gradients (or Laplacian values) for samples near a boundary and for determining gradient values ​​within a window outside a boundary in ways that potentially improve the accuracy of the gradients, directionality, and ALF performed on those samples, thereby potentially improving the subjective and / or objective quality of the filtered sampled clips.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In one example, a method for programming video data includes reconstructing a video data segment to generate a reconstructed video data segment. The method further includes determining a gradient value for a sample in the reconstructed video data segment, including calculating a gradient for the sample using an available sample corresponding to an unavailable sample located outside one of: an image, a slide, a panel, or a set of panels containing the reconstructed sample segments. The method further includes determining a twin-loop filter for the reconstructed video data segment based at least in part on the determined gradient value of the sample. The method further includes applying the determined twin-loop filter to the reconstructed video data segment to generate a candidate video data segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, a device includes a memory configured to store a video data segment, and the device further includes one or more processors implemented in circuitry, in communication with the memory, the one or more processors configured for the purpose of: reconstructing the video data segment to generate a reconstructed video data segment; determining a gradient value for a sample in the reconstructed video data segment, comprising performing a gradient calculation for the sample using an available sample corresponding to an unavailable sample located outside one of: an image, a slide, a plate, or a plurality of plates comprising the reconstructed video data segment; determining a twin-loop filter for the reconstructed video data segment based at least in part on the determined gradient value; and applying a twin-loop filter to the reconstructed video data segment to generate a filtered video data segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, an apparatus adapted for programming video data includes a means for reconstructing a video data segment to generate a reconstructed video data segment. The apparatus further includes a means for determining a gradient value for a sample in the reconstructed video data segment, comprising calculating a gradient for the sample using an available sample corresponding to an unavailable sample located outside one of: an image, a slide, a plate, or a plurality of plates comprising the sample segments. The apparatus further includes a means for determining a twin-loop filter for the reconstructed video data segment based at least in part on the specified gradient value of the sample. The apparatus further includes a means for applying the specified twin-loop filter to the reconstructed video data segment to generate the filtered video data segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, a computer-readable storage medium is encoded with instructions which, when executed, cause one or more processors configured to program the data to: reconstruct a video data segment to create a reconstructed video data segment; determine a gradient value for a sample in the reconstructed video data segment, comprising calculating a gradient for the sample using an available sample that corresponds to an unavailable sample that falls outside one of:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> An image, slide, panel, or set of panels containing the reconstructed sample clips; determining a twin-ring filter for the reconstructed video data clip based at least in part on the specified gradient value of the sample; and applying the specified twin-ring filter to the reconstructed video data clip to generate a candidate video data clip.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Details of one or more examples are given in the accompanying drawings and description below. Additional features, objectives, and advantages will be apparent from the description, drawings, and protective elements.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Brief explanation of the drawings<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figure 1 represents a step-by-step diagram illustrating an example of a video encoding and decoding system that might perform these detection techniques.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Figure 2 shows examples of samples located outside an image, slide, plate, or plate group that are not available for sample classification and filtering as part of a twin ring filtering procedure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figures 3a and 3b illustrate techniques for calculating a gradient for twin ring filtering using unavailable samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figures 4a-4h illustrate the calculation of gradient values ​​for a section.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figure 5 shows an example of a twin loop filter.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figure 6 shows an example of a twin loop filter.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figure 7 is a schematic diagram illustrating an example of a video encoder that might perform these detection techniques.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figure 8 is a schematic diagram illustrating an example of a video encoder that might perform these detection techniques.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figure 9 shows an example implementation of a filter module to perform these detection techniques.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figure 10 represents a sequence diagram illustrating an example method for decoding a current segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figure 11 represents a sequence diagram illustrating an example of a method for programming video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Detailed description:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">This disclosure describes techniques for filtering operations that can be used in post-processing, as part of loop programming, or in the predictive phase of video programming. The techniques in this disclosure may be implemented in existing video programming hardware, such as HEVC (High Efficiency Video Computing), or may be an effective programming tool for a future video programming standard, such as the H.266 standard currently under development.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Video programming typically involves predicting a video data segment either from a video data segment already programmed in the same image (i.e., interprediction) or from a video data segment already programmed in a different image (i.e., interprediction). In some cases, the video encoder also calculates any residual data by comparing the predicted segment with the original segment. The residual data thus represents the difference between the predicted segment and the original segment. The video encoder converts and quantizes the residual data and sends the converted and quantized residual data in the encoded bitstream. The video encoder adds the residual data to the predicted segment to produce a reconstructed video data segment that matches the original video segment more closely than the predicted segment alone.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">To further improve the quality of the decoded video, a video decoder may perform one or more filtering operations on the reconstructed video segments. Examples of such filtering operations include segment removal filtering, sample-to-sample offset (SAO) filtering, and amplitude loop filtering (ALF). Variables of these filtering operations may either be determined by the video encoder and transmitted explicitly in the encoded video bitstream or be implicitly determined by the video decoder without requiring the variables to be transmitted explicitly in the encoded video bitstream. This disclosure describes techniques related to ALP filtering. ALF may be used in post-processing, in-loop programming, or in a prediction process.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">A video decoder may perform classification operations on samples in video data as part of performing ALF on the video data. To perform these classification operations on samples in the video data, the video decoder may perform different computations for each sample in the video data, including calculating the gradient values ​​of the samples in the video data based at least in part on neighboring samples. However, when a sample is on the boundary of an image, slice, panel, or set of panels, one or more neighboring samples used to compute the gradient values ​​for the sample may be unavailable because one or more of the neighboring samples lie outside the boundary of the image, slice, panel, or set of panels.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In one example, a video decoder might use techniques such as recursive padding to replace neighboring samples that fall outside the boundary of an image, slice, panel, or group of panels with the nearest samples located within the boundary. However, these techniques can potentially lead to a loss of subjective and / or objective quality. For example, recursive padding might introduce discontinuities in the reconstructed video data that might not otherwise be apparent and contained the actual sample values ​​used.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In accordance with aspects of the present disclosure, a video decoder may compute gradient values ​​for a sample at the boundary of an image, slice, plate, or group of plates in ways that potentially improve the subjective and / or objective quality of the samples after filtering. In one example, the video decoder may compute gradient values ​​for a sample at the boundary of an image, slice, plate, or group of plates by replacing one or more neighboring samples located outside the boundary of the image, slice, plate, or group of plates with sample values ​​for one or more samples from the nearest unavailable sample within the images, slice, plate, or group of plates along the gradient direction. By replacing one or more neighboring samples located outside the boundary of the image, slice, plate, or group of plates with sample values ​​for one or more samples from the nearest unavailable sample within the image, slice, plate, or group of plates along the gradient direction, the techniques described herein may improve the subjective and / or objective quality of the samples after filtering compared to techniques such as iterative padding, thereby providing a technical solution to the potential technical problem described above.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As used in this disclosure, the term "video programming" generally refers to either video encoding or video decoding. Similarly, the term "video programmer" may generally refer to a video encoder or a video decoder. Furthermore, some of the techniques described in this disclosure for video decoding may also apply to video encoding, and vice versa. For example, video encoders and video decoders are often configured to perform the same, or interchangeably, operation. Also, a video encoder typically performs video decoding as part of the process of determining how to encode video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figure 1 is a step-by-step diagram illustrating an example of a video encoding and decoding system 100 that may implement the techniques of this disclosure. The techniques of this disclosure are generally directed to the programming (encoding and / or decoding) of video data. In general, video data includes any data for video processing. Thus, video data may be raw data, undecoded video data, encoded video data, decoded (e.g., reconstructed) video data, and video metadata, such as signaling data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As shown in Figure 1, the system 100 includes a source device 102 that provides encoded video data to be decoded and displayed by a destination device 116, in this example. In particular, the source device 102 provides video data to the destination device 116 via a computer-readable medium 110. The source device 102 and the destination device 116 may be any of a wide variety of devices, including desktop computers, portable computers (e.g., laptop computers), tablet computers, set-top boxes, telephone devices such as smartphones, televisions, cameras, projectors, digital media players, video game consoles, or the like. In some cases, the source device 102 and destination device 116 may be equipped for wireless communication and may therefore be referred to as wireless communication devices.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In example 1, source device 102 includes a video source 104, memory 106, a video encoder 200, and an output interface 108. Destination device 116 includes an input interface 122, a video decoder 300, memory 120, and a display device 118. In accordance with this disclosure, the video encoder 200 of the source device 102 and the video decoder 300 of the destination device 116 may be configured to implement techniques for twin-loop filtering. Thus, source device 102 is an example of a video encoder, while destination device 116 is an example of a video decoder. In other examples, the source device and destination device may include other components or equipment. For example, the source device 102 may receive video data from an external video source, such as an external camera. Similarly, destination device 116 may interface with an external display device, rather than including an integrated display device.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">System 100 as shown in Figure 1 is only one example. In general, any digital video encoder and / or decoder may perform twin-loop filtering techniques. Source device 102 and destination device 116 are examples of such programming devices in which source device 102 generates programmed video data for transmission to destination device 116. This disclosure refers to a "programming" device as a device that performs data encoding (encoding and / or decoding). Thus, video encoder 200 and video decoder 300 are examples of programming devices, namely, a video encoder and a video decoder, respectively. In some examples, source device 102 and destination device 116 may operate in a substantially analogous manner such that both source device 102 and destination device 116 include video encoding and decoding components. Thus, system 100 may support one-way or two-way video transmission between source device 102 and destination device 116, e.g., for displaying a video stream, video display, video broadcasting, or video telephony.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In general, the video source 104 represents a source of video data (e.g., raw data, undecoded video data) and provides a sequence of images (also referred to as "frames") of video data to the video encoder 200, which encodes the data for the images. The video source 104 may include a video capture device 102, such as a video camera, a video archive containing previously captured raw video, and / or a video feed interface for receiving video from a video content provider. Alternatively, the video source 104 may generate data based on computer graphics, such as source video, or a combination of live and archived video, or computer-generated video. In each case, the video encoder 200 encodes the captured, previously captured, or computer-generated video data. The video encoder 200 may reorder the images from the received order (sometimes referred to as the "display order") into a programming order for programming. The video encoder 200 may generate a bit stream including encoded video data.<h2 style=";text-align:left;direction:ltr">The source device 102 may then output the encoded video data via the output interface 108 onto a computer-readable medium 110 for reception and / or retrieval via, for example, the input interface 122 of the destination device 116.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The memory 106 of the source device 102 and the memory 120 of the destination device 116 represent general-purpose memory devices. In some examples, the memory 106 of the source device 102 and the memory 120 of the destination device 116 may store raw video data, e.g., raw video from the video source 104 and raw video data decoded by the video decoder 300. In addition or alternatively, the memory devices 106 and 120 may store code executable by, e.g., the video encoder 200 and the video decoder 300, respectively. Although the memory 106 and the memory 120 are shown separately from the video encoder 200 and the video decoder 300 in this example, it should be understood that the video encoder 200 and the video decoder 300 also include internal memory devices for similar or functionally equivalent purposes. Furthermore, memory devices 106, 120 may store encoded video data, e.g., output from video encoder 200 and input to video decoder 300.<h2 style=";text-align:left;direction:ltr">In some examples, portions of the memory devices 106, 120 may be designated as one or more video buffers, for example, to store raw, decoded, and / or encoded video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">A computer-readable medium 110 may represent any type of media or device capable of transmitting encoded video data from a source device 102 to a destination device 116. In one example, the computer-readable medium 110 represents a communication medium enabling the source device 102 to transmit encoded video data directly to the destination device 116 at the actual time of the event, e.g., over a radio frequency or computer-based network. The output interface 108 may modulate a transmission signal, including the encoded video data, and the input interface 122 may demodulate the received transmission signal, in accordance with a communication standard, such as a wireless communication protocol. The communication medium may include any wireless or wired communication medium, such as the radio frequency (RF) spectrum or one or more physical transmission lines. The communication medium may form part of a packet-based network, such as a local area network, a wide area network, or a global network such as the Internet. The communication medium may include routers, switches, base stations, or any other equipment that may be useful for facilitating communication from the source device 102 to the destination device 116.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the source device 102 may output encoded data from the output interface 108 to the storage device 112. Similarly, the destination device 116 may access encoded data in the storage device 112 via the input interface 122. The storage device 112 may include any variety of distributed or locally accessed data storage media such as a hard disk, Blu-ray discs, DVDs, CD-ROMs, flash memory, volatile or non-volatile memory, or any other digital storage media suitable for storing encoded video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the source device 102 may output encoded video data to a file server 114 or other intermediate storage device that may store the encoded video generated by the source device 102. The destination device 116 may access the video data stored in the file server 114 via streaming or downloading. The file server 114 may be any type of server device capable of storing encoded video data and transmitting that encoded video data to the destination device 116. The file server 114 may be a web server (e.g., for a website), a file transfer protocol (FTP) server, a content delivery network device, or a network-attached storage (NAS) device. The destination device 116 may access the encoded video data from the file server 114 through any standard data connection, including an Internet connection. It may include a wireless channel (e.g., a Wi-Fi connection), a wired connection (e.g., a digital subscriber line (DSL), a cable modem, etc.), or a combination of both suitable for accessing the encoded video data stored in the file server 114.<h2 style=";text-align:left;direction:ltr">The file server 114 and the input interface 122 may be configured to operate according to a streaming transmission protocol, a download transmission protocol, or a combination thereof.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The output interface 108 and the input interface 122 may be a wireless transceiver, modem, wired networking components (e.g., Ethernet cards), wireless communications components operating in accordance with a variety of IEEE 802.11 standards, or other physical components. In examples where the output interface 108 and the input interface 122 include wireless components, the output interface 108 and the input interface 122 may be configured to transmit data, such as encoded video data, in accordance with a cellular communication standard, such as 4G, 4G-LTE (Long Term Evolution), LTE Advanced, 5G, or the like. In examples where the output interface 108 includes a wireless transmitter, the output interface 108 and the input interface 122 may be configured to transmit data, such as encoded video data, in accordance with other wireless standards, such as the IEEE 802.11 specification, the IEEE 802.15 specification (e.g., ZigBee™), the Bluetooth™ standard, or the like. In some examples, the source device 102 and / or destination device 116 may include system-on-a-chip (SoC) devices.<h2 style=";text-align:left;direction:ltr">For example, the source device 102 may include an SoC to perform the function attributed to the video encoder 200 and / or the output interface 108, and the destination device 116 may include an SoC to perform the function attributed to the video decoder 300 and / or the input interface 122.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The techniques of this disclosure may be applied to video programming to support any of a variety of multimedia applications, such as over-the-air television broadcasting, cable television broadcasting, satellite television broadcasting, Internet video broadcasting, such as Dynamic Twin Streaming over HTTP (DASH), digital video encoded onto a data storage medium, decoding of digital video stored on a data storage medium, or other applications.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The input interface 122 of the destination device 116 receives an encoded video bit stream from a computer-readable medium 110 (e.g., a communication medium, a storage device 112, a file server 114, or the like). The encoded video bit stream may include signaling information defined by the video encoder 200 and also used by the video decoder 300, such as syntax elements with values ​​that describe the characteristics and / or processing of video segments or other programmable units (e.g., slides, pictures, group of pictures, sequences, or the like). The display device 118 displays the decoded images of video data to a user. The display device 118 may be any of a variety of display devices, such as a cathode ray tube (CRT) display, a liquid crystal display (LCD), a plasma display, an organic light-emitting diode (OLED) display, or any other type of display device.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Although not shown in Figure 1, in some examples, the video encoder 200 and the video decoder 300 may be combined with an audio encoder and / or an audio decoder, and may include suitable MUX-DEMUX modules, firmware, and / or other software, to process multiplexed streams including audio and video into a common data stream. If applicable, the MUX-DEMUX modules may comply with the ITU H.223 multiplexing protocol, or other protocols such as the User Datagram Protocol (UDP).<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 and video decoder 300 may be implemented as any device consisting of a variety of suitable encoder and / or decoder circuits, such as one or more microprocessors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), discrete logic circuits, software, hardware, firmware, or any combinations thereof. When the technologies are partially implemented in software, the device may store software-specific instructions in a suitable non-volatile computer-readable medium and execute the instructions in the device using one or more processors to implement the technologies of this disclosure. Both the video encoder 200 and the video decoder 300 may be embedded in one or more encoders or decoders, and each may be integrated as part of a combined encoder / decoder (CODEC) device in its respective device. A device comprising a video encoder 200 and / or a video decoder 300 may include an integrated circuit, a microprocessor, and / or a wireless communication device, such as a cellular telephone.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 and the video decoder 300 may operate in accordance with a video programming standard, such as ITU-T H.265, also referred to as High Efficiency Video Codec (HEVC), or its extensions, such as Multiview and / or Scalable Video Codec Extensions. Alternatively, the video encoder 200 and the video decoder 300 may operate in accordance with other proprietary or industry standards, such as the Link Exploration Test Model (JEM) or ITU-T H.266, also referred to as Versatile Video Codec (VVC). A recent draft VVC standard is described by Bross, et al., "Versatile Video Coding (Draft 7)", Joint Video Experts Team (JVET) for ITU-T SG 16 WP 3 and ISO / IEC JTC I / SC 29 / WG 11, 16th Meeting: Geneva, CH, 1-11 October 2019, JVET-P2001-v9 (hereafter "VVC Draft 7"). However, the techniques of this disclosure are not limited to any particular coding standard.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In general, the video encoder 200 and the video decoder 300 may program segment-based images. The term "segment" generally refers to a structure containing data to be processed (e.g., encoded, decoded, or used in an encoding and / or decoding process). For example, a segment may include a two-dimensional array of brightness and / or chrominance data samples. In general, the video encoder 200 and the video decoder 300 may program video data represented in a YUV format (e.g., Y, Cb, Cr). That is, instead of programming red, green, and blue (RGB) data samples from an image, the video encoder 200 and the video decoder 300 may program brightness and chrominance components, where the chrominance components may include both red and blue hue components. In some examples, video encoder 200 converts received RGB data to a YUV representation prior to encoding, and video decoder 300 converts the YUV representation to RGB. Alternatively, pre- and post-processing modules (not shown) may perform these conversions.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">This disclosure may generally refer to programming (e.g., encoding and decoding) images such that the encoding or decoding process includes image data. Similarly, this disclosure may refer to programming segments of an image such that the encoding or decoding process includes data encoding or decoding for the segments, e.g., prediction and / or residual programming. An encoded video bitstream generally includes a series of values ​​for syntax elements representing programming decisions (e.g., programming modes) and segmentation of images into segments. Thus, references to encoding an image or segment should generally be understood as programming values ​​for the syntax elements that comprise the image or segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">HEVC defines various segments, including programming units (CUs), prediction units (PUs), and transformation units (TUs). In accordance with HEVC, a video coder (such as the video encoder 200) partitions a programming tree unit (CTU) into coding units (CUs) according to a quadtree structure. That is, the video coder partitions the CTUs and CUs into four equal, non-overlapping boxes, each node of the quadtree having either zero or four subnodes. Nodes without subnodes may be referred to as "leaf nodes," and the CUs of these leaf nodes may include one or more PUs and / or one or more TUs. The video coder may also partition PUs and TUs. For example, in HEVC, a residual quadtree (RQT) represents the partitioning of TUs. In HEVC, PUs represent interpredictive data, while TUs represent residual data. CUs that are interpredictive include interpredictive information, such as an internal mode statement.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As another example, the video encoder 200 and the video decoder 300 may be configured to operate under a JEM or VVC. In accordance with the JEM or VVC, the video coder (such as the video encoder 200) partitions the image into a set of programming tree units (CTUs). The video encoder 200 may partition the CTU according to a tree structure, such as a quadrilateral binary tree (QTBT) or a multi-type tree (MTT) structure. The QTBT structure eliminates the concept of multiple partition types, such as the separation of CUs, PUs, and TUs, which is specific to HEVC. The QTBT structure includes two levels: the first level is partitioned according to a quadrilateral tree partition, and the second level is partitioned according to a binary tree partition. A root node of the QTBT structure corresponds to a CTU. The leaf nodes of the binary trees correspond to programming units (CUs).<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Sections (for example, CTUs or CUs) can be grouped in different ways in an image. As one example, a brick might refer to a rectangular region of CTU rows within a particular panel in an image. Panels might be a rectangular region of CTUs within a particular panel column and panel row in an image.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">A panel column refers to a rectangular area of ​​CTUs with a height equal to the image height and a width specified by syntax elements (for example, in an image variable set). A panel row refers to a rectangular area of ​​CTUs with a height specified by syntax elements (for example, in an image variable set) and a width equal to the image width.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, a board may be divided into multiple bricks, each of which may contain one or more CTU rows within the board. A board that is not divided into multiple bricks may also be referred to as a single brick. However, a brick that is a true subset of a board may not be referred to as a board.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The building blocks in an image can also be arranged in a slice. A slice may be an integer number of building blocks in an image that may reside exclusively in a single Network Abstraction Layer (NAL) unit. In some examples, a slice includes either a number of complete panels or only a successive sequence of complete building blocks of a single panel.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">This statement may use "NxN" and "N ÷ N" interchangeably to refer to the dimensions of a sample clip (such as a CU or other video clip) in terms of vertical and horizontal dimensions, e.g., 16x16 or 16÷16 samples. In general, a 16x16 CU will contain 16 samples in the vertical direction (y = 16) and 16 samples in the horizontal direction (x = 16). Similarly, an NxN CU generally contains N samples in the vertical direction and N samples in the horizontal direction, where N is a non-negative integer value. Samples in a CU can be arranged in rows and columns. Furthermore, CUs do not necessarily need to have the same number of samples in the horizontal direction as in the vertical direction. For example, a CU may contain NxM samples, where M does not necessarily equal N.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The video encoder 200 encodes video data for CUs that represent the prediction and / or residual information, and other information. The prediction information refers to how a prediction for a CU is made to form a prediction segment for the CU. The residual information generally represents the sample-to-sample differences between the pre-encoding CU samples and the prediction segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">For the purpose of CU prediction, the video encoder 200 may generally generate a prediction segment for the CU through interprediction or interprediction. Interprediction generally refers to a prediction for the CU from preprogrammed image data, while interprediction generally refers to a prediction for the CU from preprogrammed data for the same image. For the purpose of interprediction, the video encoder 200 may generate a prediction segment using one or more vectors. The video encoder 200 may generally perform a motion search to identify a reference segment that most closely matches the CU, e.g., in terms of the differences between the CU and the reference segment. The video encoder 200 may calculate a difference metric using sum of absolute differences (SAD), sum of squared differences (SSD), mean absolute difference (MAD), mean squared differences (MSD), or other difference calculations to determine whether a reference segment matches the current CU. In some examples, the video encoder 200 may predict the current CU using one-way prediction or two-way prediction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Some examples of JEM and VVC also provide a specific motion compensation mode, which can be considered an inter-prediction mode. In a specific motion compensation mode, the video encoder 200 may define two or more motion vectors representing non-synchronous motion, such as zooming, panning, rotation, perspective motion, or other types of non-uniform motion.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> For the purpose of internal prediction, the video encoder 200 may select an internal prediction mode to generate the prediction segment. Some examples of JEM and VVC provide sixty-seven internal prediction modes, including various directional modes, as well as planar and DC modes. In general, the video encoder 200 selects an internal prediction mode that describes the adjacent samples of a current segment (e.g., a segment of a CU) from which to predict samples of the current segment. These samples may generally be above, above, to the left, or to the left of the current segment in the same picture as the current segment, assuming the video encoder 200 programs the CTUs and CUs in raster scan order (left to right, top to bottom).<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 encodes data representing the prediction mode of a current clip. For example, for interprediction modes, the video encoder 200 can encode data representing any of the various available interprediction modes in use, as well as motion information for the corresponding mode. For unidirectional or bidirectional interprediction, for example, the video encoder 200 can encode motion vectors using advanced motion vector prediction (AMVP) or fusion mode. The video encoder 200 can use similar modes to encode motion vectors for the approximate motion compensation mode.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">After prediction, such as intra-prediction or inter-prediction of a segment, the video encoder 200 may calculate the residual data for the segment. The residual data, such as the segment residual, represents sample-to-sample differences between the segment and the predicted segment of the segment, which are modeled using the corresponding prediction mode. The video encoder 200 may apply one or more transformations to the residual segment, producing transformed data in the transformation domain rather than the sample domain. For example, the video encoder 200 may apply a discrete cosine transform (DCT), integer transform, wavelet transform, or a conceptually similar transformation to the residual video data. In addition, the video encoder 200 may apply a secondary transformation after the first transformation, such as a mode-dependent non-separable secondary transform (MDNSST), a signal-dependent transform, a Karhunen-Loeve transform (KLT), or the like. The video encoder 200 produces transformation coefficients after applying the one or more transformations.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As noted above, after any transformation to produce the transformation coefficients, the video encoder 200 may quantize the transformation coefficients. Quantization generally refers to a process by which the quantity of transformation coefficients is determined to potentially reduce the amount of data used to represent the transformation coefficients, providing further comparability. By performing quantization, the video encoder 200 may reduce the bit depth associated with some or all of the transformation coefficients. For example, the video encoder 200 may approximate an n-bit value to an m-bit value during quantization, where n is greater than m. In some examples, to perform quantization, the quantizer 200 may perform a right-shift of the value to be quantized.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Following quantization, the video encoder 200 may scan the transformation coefficients to produce a one-dimensional vector from the two-dimensional array containing the quantized transformation coefficients. The scan may be designed to place the higher-energy (and therefore lower-frequency) transformation coefficients at the front of the carrier and to place the lower-energy (and therefore higher-frequency) transformation coefficients at the rear of the carrier. In some examples, the video encoder 200 may use a predefined scan order to scan the quantized transformation coefficients to produce a concatenated vector, and then entropically encode the quantized transformation coefficients of the carrier. In other examples, the video encoder 200 may perform a twin scan. After scanning the quantized transformation coefficients to form the one-dimensional carrier, the video encoder may entropically encode the one-dimensional carrier, for example, according to context-adaptive binary arithmetic programming (CABAC). The video encoder 200 may also entropically encode values ​​for syntax elements describing metadata associated with the encoded video data for use by the video decoder 300 in de-assembling the video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">To perform CABAC, the video encoder 200 may assign a context within the context model to a symbol to be transmitted. The context may relate, for example, to whether the values ​​adjacent to the symbol are zero values. The determination of the probability may depend on the context assigned to the symbol.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The video encoder 200 may also generate syntax data, such as segment-based syntax data, picture-based syntax data, and sequence-based syntax data, for the video decoder 300, for example, in a picture header, a clip header, a slice header, or other syntax data, such as a sequence criteria set (SPS), a picture criteria set (PPS), or a video criteria set (VPS). The video decoder 300 may likewise decode such syntax data to determine how to decode the corresponding video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In this way, the video encoder 200 can generate a bitstream including the encoded video data, e.g., syntax elements describing the segmentation of the image into segments (e.g., CUs), prediction information, and / or residual information for the segments. Finally, the video decoder 300 can receive the bitstream and decode the decoded video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In general, the video decoder 300 can perform an operation reciprocal to that performed by the video encoder 200 to decode the bitstream encoded video data. For example, the video decoder 300 can decode the values ​​of the bitstream syntax elements using CABAC in a manner substantially similar to, but reciprocal to, the CABAC encoding operation of the video encoder 200. The syntax elements can specify the segmentation information for an image into CTUs, and segment each CTU according to a corresponding segmentation structure, such as a QTBT structure, to specify the CUs for the CTU. The syntax elements can also specify prediction information and residual information for segments (e.g., CUs) of the video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The remaining information may be represented by, for example, quantization coefficients. The video decoder 300 may invert the quantization and invert the transformation of the quantization coefficients of a clip to reproduce a residual segment of the clip. The video decoder 300 uses a signal prediction mode (intra- or inter-prediction) and related prediction information (for example, motion information for the inter-prediction) to form a prediction segment of the clip. The video decoder 300 may then combine the prediction segment and the residual segment (on a sample-by-sample basis) to reproduce the original clip. The video decoder 300 may perform additional processing, such as de-sampling to reduce visual artifacts along the clip boundaries.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In accordance with the techniques of this disclosure, a video encoder and / or video decoder may be configured to reconstruct a segment of video data to generate a reconstructed segment of video data, specify a gradient value for a sample in the reconstructed video data segment, which includes performing a gradient calculation for the sample using an available sample that corresponds to an unavailable sample located outside one of: an image, a slide, a panel, or a group of panels that comprises the reconstructed sampled segment, specifying a twin-loop filter for the reconstructed video data segment based at least in part on the specified value of the sample gradient, and applying the specified twin-loop filter to the reconstructed video data segment to generate the filtered video data segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">This disclosure may generally refer to the "signaling" of certain information, such as syntax elements. The term "signaling" may generally refer to the communication of syntax element values ​​and / or other data used to decode the encoded video data. That is, the video encoder 200 may signal values ​​for syntax elements in the bitstream. In general, signaling refers to the generation of a value in the bitstream. As noted above, the source device 102 may transmit the bitstream to the destination device 116 substantially in real time, or non-real time, such as when the syntax elements are stored in the storage device 112 for later retrieval by the destination device 116.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In the field of video programming, it is common to apply filtering (e.g., a twin-loop filter) to enhance the quality of the reconstructed and / or demultiplexed video signal. In the context of this disclosure, a reconstructed video data segment may refer to a video data segment that is reconstructed in the reconstruction loop of the video encoder 200, or it may refer to a video data segment that is decoded by the video decoder 300. In some examples, the filter may be implemented as a post-filter, where the filtered frame is not used to predict future frames, or the filter may be implemented as an in-loop filter, where the filtered frame is used to predict future frames. The filter may be designed, for example, to minimize the error between the original signal and the reconstructed / demultiplexed filtered signal. Similarly, for conversion coefficients, the video encoder 200 may quantize the filter coefficients h(k,l), k = -K, .." K,l = -K, .., K by:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> [(k,l) = round (normFactor ' h(k,l))<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 may transmit programmed quantum coefficients to the video decoder 300. The normalization factor (normFactor) may be equal to 2n. The larger the normFactor, the more accurate the normalization and the better the performance of the quantized filter coefficients f(k, l). However, larger values ​​of the normFactor f(k, l) result in more bits being transmitted.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In the video decoder 300, the decoded filter coefficients f(k, l) are applied to the reconstructed image / reconstructed segment R(I, j) as follows:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (1)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> where i and j are the coordinates of the samples within the frame or section.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The video encoder 200 and video decoder 300 may be configured to apply different ALF filtering techniques. Aspects of these filtering techniques (e.g., ALF) will not be described here.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In-loop ALF was evaluated during the HEVC development phase. However, in-loop ALF has been adopted for VVC. Details of an example can be found in B. Bross, J. Chen, and S. Liu,<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> "JVET-LI00l: Versatile Video Coding (Draft 3)", which is a simplified version of ALF<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Described in M. Karczewicz, L. Zhang, W.-J. Chien, X. Li, "EE2.5: Improvements to the Twin Loop Filter", Exploration Team (JVET) ofITU-T SG 16 WP 3 and ISO / IEC JTC I / SC 29 / WG 11, Doc. JVET-B0060, 2nd Meeting: San Diego, USA, 20 Feb. – 26 Feb. 2016 and M. Karczewicz, L. Zhang, W.-J. Chien, X. Li, "EE2.5: Improvements to the Twin Loop Filter", Exploration Team (JVET) ofITU-T SG 16 WP 3 and ISO / IEC JTC I / SC 29 / WG 11, Doc. JVET -C003 8, 3rd Meeting: Geneva, CH, 26 May - 1 June 2016.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In VVC, for the luma components in an image, video encoder 200 and video decoder 300 may be configured to apply a 7×7 diamond filter for ALF. In VVC, for each of the chroma components (e.g., Cr and Cb) in an image, video encoder 200 and video decoder 300 may be configured to apply a single set of ALF coefficients, such as a 5×5 diamond filter. In some examples, other filter shapes may also be used.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video decoder 300 may be configured to filter each sample, resulting in a sample value as shown in Equation (2), where L denotes the filter length, θ represents the filter coefficient, and O denotes the filter offset.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Where in VVC Test Pattern 3 (VTM3), the bit depth, referred to as BDF, is set to 8.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In the VVC 5 test model (VTM5.0), the snapshot was entered into the ALF, and Equation (2) was modified as shown in Equation (2*)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (2*)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> where Cm,n represent the working parameters of the sections.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">ALF was adopted in VVC Draft 4. A detailed description of ALF classification can be found in U.S. patent application 427,017 / 16, filed May 30, 2019. In VVC, classification is performed for each 4×4 luma segment using subsampling gradient calculation, as described in “CE2: Laplacian Subsampling Calculation (Test 6.1, 6.2, 6.3, and 6.4),” JVET-L0147, 12th Meeting: Macao, CN, Oct 3-12, 2018. In addition, a 7-stop filter is applied to luma samples and a 5-stop filter is applied to chroma samples. In VVC Draft 7, ALF uses seven (7) buffer lines to store the additional samples due to the use of a de-clustering filter and SAO along the horizontal boundaries between CTUs.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> A detailed description of the use of cache lines can be found in JVET-M0164 and JVET-M0301.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> To reduce or eliminate the number of lines for storing samples from adjacent CTUs, some techniques have been developed, such as JVET-M0164, JVET-M0301, US patent application 200,197 / 16, filed November 26, 2018, and US patent 9,641,866, issued May 2, 2017.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The techniques in “Twin Ring Filter with Virtual Boundary Processing,” JVET-M0164, 13th Meeting: Marrakech, MA, 9-18 Jan. 2019 (hereafter JVET-M0164); “Non-CE: Reducing Buffer Lines for Ring Filters,” JVET-M0301, 13th Meeting: Marrakech, MA, 9-18 Jan. 2019 (hereafter JVET-M0301); US Patent Application 200,197 / 16; and US Patent 9,641,866 apply only to horizontal boundaries between CTUs. In VVC Draft 7, double padding is applied at the boundaries of an image, slice, plate, or set of plates due to unavailability of samples outside the image, slice, plate, or set of plates.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Video encoder 200 and video decoder 300 may be configured to select one of a set of ALF classes to apply to a video data segment (e.g., a segment of luma and / or chroma samples). When implementing VTM3, video encoder 200 and video decoder 300 are configured to apply classification to each 4x4 luma segment. Video encoder 200 and video decoder 300 may be configured to classify each 4x4 segment into one of 25 classes based on the specified directionality and quantized activity value of the segment. Details are described below.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Video encoder 200 and video decoder 300 may be configured to determine the ALF classification of a clip based on the 1D Laplacian orientation of the clip samples and the 2D Laplacian activity of the clip samples for each 4×4 luma clip. In one example, video encoder 200 and video decoder 300 may be configured to calculate the sum of the gradients for each two samples within an 8×8 window spanning the 4×4 luma clip to determine the gradient values ​​for the clip.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 and video decoder 300 can be configured to calculate four gradient values: a vertical gradient value denoted gv, a horizontal gradient value denoted gh, a 135-degree radial gradient value denoted gd1, and a 45-degree radial gradient value denoted gd2. Table 1 below shows the possible directional values ​​that can be determined from the gradients and their physical meanings in relation to the sample values ​​for the section. For a 4×4 subsection with an upper-left coordinate (i,j), the gradient values ​​gv, gh, gd1, and gd2 are determined as follows:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> where, if both k and l are even numbers or both k and l are not even numbers; = zero, otherwise<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> where, if both k and l are even numbers or both k and l are not even numbers; = zero, otherwise<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> where, if both k and l are even numbers or both k and l are not even numbers; = zero, otherwise<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> where, if both k and l are even numbers or both k and l are not even numbers; = zero, otherwise.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Table 1. Trend values ​​and their physical meanings<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Directional values ​​physical meanings<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Zero fabric<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> 1 Strong Horizontal / Vertical<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> 2 horizontal / vertical<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> 3 strong Qatari<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> 4 Qatari<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> To assign direction D, video encoder 200 and video decoder 300 may be configured to compare the ratio of maximum and minimum horizontal and vertical gradient values, denoted by Rh,v in equation (3) below, and the ratio of maximum and minimum diagonal gradients, denoted by Rd1,d2 in equation (4), against each other with thresholds t1 and t2.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (3) Where<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (4) Where<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> By comparing the detected ratios of horizontal / vertical and diagonal gradients, the video encoder 200 and the video decoder 300 may determine five direction modes, i.e., D, in the range [0, 4] inclusive, as defined in Equation (5) below.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (5)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The video encoder 200 and the video decoder 300 may calculate an Act activity value.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> For the clip as follows:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (6)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 and the video decoder 300 may also quantize the activity value Act to the range 0 to 4 inclusive, and the quantization value is denoted as Â. This quantization process is detailed below.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> An example of a quantization process is defined as follows:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> where NUM_ENTRY is set to 16, ScaleFactor is set to 24, shift represents (3 + internally programmed bit depth), ActivityTolndex[NUM_ENTRY] = {0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4}, and Clip_post(a, b) returns the smallest value between a and b.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Due to the different ways of calculating activity value, both ScaleFactor and ActivityTolndex can be modified compared to the ALF design in JEM2.0.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In the example of a geometric transformation-based ALF (GALF) scheme, the video encoder 200 and the video decoder 300 can be configured to classify each NxN segment into one of 25 classes (C) based on the segment's direction D and the segment's activity  quantum value as follows:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (7)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In one example, the value of  is set to 0...4 for each column, which is derived from the variable Act. The smallest Act for the new value of  is highlighted across the top row (e.g., 0, 8192, 16384, 5734, 122880). For example, Act with values ​​within [16384, 57344 - 1] would fall into  equals 2.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> For each classification, the video encoder 200 may be configured to indicate one set of filter coefficients.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> To better distinguish between different orientations of segments labeled with the same class index, four geometric transformations can be used, including no transformation, oblique line, vertical face, and rotation. The shape formulas for the three additional geometric transformations can be expressed as follows:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Qatari:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Vertical face:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Rotation:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">where K represents the filter size, and f represents the coordinates of the coefficients, such that location (0,0) is at the upper left corner of the segment and location (K – 1, K – 1) is at the lower right corner of the segment. Note that when using a diamond-shaped filter support, coefficients with coordinates outside the filter support can be set to 0. One technique for referring to the geometric transformation guide is to derive the geometric transformation implicitly (i.e., without sending signals) to avoid additional overhead. In some GALF examples, transformations are applied to the filter coefficients based on the gradient values ​​calculated for that segment. The relationship between the transformation and the four gradients is described in Table 2 below. In one or more examples, the transformations are based on which of the two gradients (horizontal and vertical, or gradients of 45° and 135°) is larger. Based on the comparison, more accurate directional information can be extracted. Therefore, different filtering results can be obtained due to the transformation while not increasing the overhead of the filter coefficients.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Table 2. Gradient and transition planning.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Transform gradient values<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> No conversion<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> italic line<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> My head<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> rotation<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> As discussed above, when an image, slice, panel, or panel group boundary includes both horizontal as well as vertical boundaries, samples outside of these boundaries are not available to the video encoder 200 and video decoder 300 to perform classification and filtering operations on samples along these boundaries for ALF purposes. An image boundary may be a boundary of a video data frame, while a slice, panel, or panel group boundary may be a boundary separating portions of a single frame of video data, such as slices, panels, and a panel group within the same frame of video data, and may also be referred to as a virtual boundary. In some examples, for purposes of the present disclosure, the boundaries discussed here do not include a CTU boundary, which is not also a slice / panel / panel group / image boundary.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Figure 2 illustrates examples of samples outside an image, slide, plate, or set of plates that are not available for sample classification and filtering as part of the twin-ring filtering procedure. As shown in Figure 2, samples 142a-142d are located within boundary 140 of section 146, where section 146 may be an image, slide, plate, or set of plates, and samples 143a-144d are located outside boundary 140 of section 146. Specifically, samples 142a-142d are said to be located along boundary 140 because samples 142a-142d are the samples on the edge of section 146, such that samples 142a-24d are each adjacent to samples 143a-144d that are outside boundary 140 of section 146.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, video encoder 200 and video decoder 300 may perform<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Classification and filtering operations for samples 142A-142D of segment 146 require the use of samples 143A-144D outside the boundary 140 of segment 146. For example, to calculate one or more gradient values ​​for sample 142A along the boundary 140, video encoders 200 and 300 may require one or more samples 143A to calculate one or more gradient values. However, because samples 143A-144D are outside the boundary 140, samples 143A-144D may not be available to perform classification and filtering operations for samples 142A-142D.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> As such, some techniques use the closest sample within the boundary 140 of segment 146 rather than a sample outside the boundary 140 to perform classification and filtering operations for samples along the boundary 140, such as samples 142a-142d. One such technique is called recursive padding and can be used on both the horizontal and vertical boundaries of the boundary 140. However, these techniques may result in a loss of subjective and / or objective quality. For example, recursive padding may introduce discontinuities in the reconstructed video data that might not otherwise have been apparent if the actual sample values ​​had been used.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Thus, rather than using techniques such as repeated padding or other similar techniques, the disclosure aspects describe techniques for determining gradients of 142A-142D samples that are along the boundary 140 of section 146 by replacing sample values ​​for one or more 143A-144D samples outside the boundary 140 of section 146 with sample values ​​from samples within section 146 in ways that are likely to improve the subjective and / or objective quality of the samples after filtration.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some aspects, the techniques of this disclosure extend the techniques of JVET-M0164, JVET-M0301, U.S. Patent Application No. 200,197 / 16, and U.S. Patent No. 9,641,866 to the horizontal and vertical boundaries of an image, slice, plate, or plurality of plates, such as the boundaries 140 of section 146. The techniques described may be applied individually or together in any combination.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In one example, video encoder 200 and video decoder 300 may perform gradient calculations as part of the twin-loop filtering procedure. As discussed above, samples may be classified into one of twenty-five (25) classes based on the total Laplacian activity and the direction of that segment. In one example, in calculating gradient values, if a sample is outside the current image / slice / panel / set of panels, such as being outside the threshold 140, and is therefore unavailable for calculating gradient values, video encoder 200 and video decoder 300 may use the sample value of the nearest unavailable sample in the current image, slice, panel, or set of panels, such as segment 146, along the gradient direction instead of the sample value of the unavailable sample when performing gradient calculations.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figures 3A and 3B illustrate gradient calculation techniques for twin-loop filtering using unavailable samples. As part of the twin-loop filtering procedure, the video encoder 200 and the video decoder 300 may perform classification and filtering operations based on calculating the gradient values ​​of the samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As illustrated in Figure 3A, segment 148 may be an image, slice, panel, group of panels, and the like, where samples outside the boundaries of segment 148 may not be available to samples within segment 148 for gradient calculations. Segment 148 may be identified, for example, by a left boundary 150a, which may be a vertical boundary, and an upper boundary 150b, which may be a horizontal boundary. The term "boundary" is used in this disclosure to refer to an image boundary or a boundary between two pieces of video data, which may exist within the same video segment or in different video segments. Thus, the term "boundary" should not be construed as limited to a boundary separating two video segments, but may also include virtual boundaries that may separate any two pieces of video data. In some examples, the term "boundary" may not include CTU boundaries that are not also slice / panel / group of panels / image boundaries.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Figure 3a shows an example of samples along the top and left borders of an image / slide / panel / panel stack. L[y,x] represents the luma sample in the y-th row and x-th column. Thus, in the example of Figure 3a, the samples could be luma samples, and are shown to have coordinates of the form L[y,x], where y is the vertical coordinate of the sample and x is the horizontal coordinate of the sample, where L[0,0] refers to the sample in the top-left corner of segment 148. As such, samples along the top border 150b may have y-coordinates of 0, while samples along the left border 150a of segment 148 may have x-coordinates of 0.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">For samples within segment 148 that are along the left boundary 150a and the upper boundary 150b (e.g., samples with x-coordinates of 0 or samples with x-coordinates of 0, respectively, assuming the upper-left sample within segment 150 has coordinates of (0, 0)), the video coder (e.g., video encoder 200 and video encoder 300) may calculate gradient values ​​for a sample based on adjacent samples along the gradient direction to be calculated. For example, the video coder may, for a sample within segment 148, calculate a horizontal direction gradient, a vertical direction gradient, a 45° diagonal direction gradient, and a 135° diagonal direction gradient.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In one example, video encoder 200 and video decoder 300 calculate the horizontal gradient, vertical gradient, and diagonal gradient values ​​for a sample using the Laplacian ID:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (9)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (10)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (11)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> (12)<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In these examples, gv represents a vertical gradient, gh represents a horizontal gradient, gd1 represents a 135° diagonal gradient, and gd2 represents a 45° diagonal gradient. Furthermore, K, I represent the coordinates of the coefficients, and R(k, 1) represents the sample at coordinates (k, 1) of the reconstructed section.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As illustrated, the video encoder 200 and the video decoder 300 may compute a gradient value for a sample based at least in part on two adjacent samples of the sample in the same gradient direction as the gradient value being computed. Specifically, the video encoder 200 and the video decoder 300 may compute the four-direction gradient values ​​for the center sample for three (3) consecutive adjacent samples. Thus, the video encoder 200 and the video decoder 300 may compute a gradient value for a sample representing the center sample for three (3) consecutive adjacent samples along the gradient direction. However, a sample adjacent to a central sample in three (3) consecutive adjacent samples may not be available for calculating the gradient value of the sample within section 148, such that if one of the adjacent samples in the same gradient direction falls outside the upper boundary 150B or falls outside the left boundary 150A of section 148, and thus falls outside an image, slice, plate, or group of plates (e.g., section 148) bounded by the upper boundary 150B and / or the left boundary 150A.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In accordance with aspects of the present disclosure, the video encoder 200 and the video decoder 300 may determine whether a neighboring sample along the same gradient direction is unavailable for calculating a gradient value for a sample, and if so, may replace it with an available neighboring sample along the same gradient direction for the unavailable sample. In particular, to calculate the gradient value for a sample representing the center sample of three (3) consecutive neighboring samples along the gradient direction, the video encoder 200 and the video decoder 300 may determine whether one of the two non-centered samples among the three consecutive neighboring samples is unavailable, and if so, may replace the unavailable sample with the other non-centered sample (i.e., the available neighboring sample) among the three consecutive neighboring samples to calculate the gradient value for the center sample. Substituting the unavailable sample for the available neighboring sample includes replacing the sample value of the unavailable sample with the sample value of the available neighboring sample for the purpose of calculating the gradient value for the center sample.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">For the purposes of calculating the gradient value, replacing an unavailable sample with an available adjacent sample may involve calculating a gradient value using the sample value of the replacement sample instead of the sample value of the unavailable sample. Thus, because the available adjacent sample is one of the three consecutive adjacent samples used to calculate the gradient value, the available adjacent sample value can be used twice when calculating the gradient value for the central sample from the three consecutive adjacent samples to represent the two non-central samples in the three consecutive adjacent samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In the example in Figure 3A, if there is a sample above the upper boundary 150b of segment 148, the sample is not available for the purposes of determining gradient values ​​for samples in segment 148 that lie along the upper boundary 150b. If the video encoder 200 and the video decoder 300 determine that one of the three consecutive adjacent samples used to calculate a gradient value for a sample abutting the upper boundary 150b lies above the upper boundary 150b, the video encoder 200 and the video decoder 300 may replace the sample outside the upper boundary 150b with the other off-center sample from the three consecutive adjacent samples to calculate a gradient value for the sample abutting the upper boundary 150b.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">For example, to calculate the vertical gradient value of sample 152a, video encoder 200 and video decoder 300 may take sample 152a at location L[0, x] as the center sample of three (3) consecutive samples along the vertical gradient direction. The other two samples of the three consecutive samples along the vertical direction with sample 152a as the center sample are the adjacent sample 152b at location L[1, x] which is directly below sample 152a in the vertical gradient direction and the adjacent sample 152c at location L[-1, x] which is directly above sample 152a in the vertical gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3a, the adjacent sample 152c that is located directly above the sample 152a at location L[-1, x] may be unavailable because the adjacent sample 152c is located outside the upper boundary 150b of the segment 148. According to aspects of the present disclosure, in response to determining that the sample 152c is unavailable, the video encoder 200 and the video decoder 300 may replace the unavailable sample 152c with the sample 152b, which is the other eccentric sample of the three consecutive adjacent samples 152a-152c along the vertical gradient direction, to determine the vertical gradient value of the sample 152a. As shown in Figure 3a, the sample 152c is replaced by the sample at location L[1, x], which is the sample 152b.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate a 45-degree diagonal gradient value for sample 152D, video encoder 200 and video decoder 300 may take sample 152D at location L[0, x] as the center sample for three (3) consecutive samples along the 45-degree diagonal gradient direction. The other two samples of the three consecutive samples along the 45-degree diagonal gradient direction with sample 152D as the center sample are the adjacent sample 152E at location L[1, x+1] which is located directly below the right of sample 152D in the 45-degree diagonal gradient direction and the adjacent sample 152F at location L[-1, x-1] which is located directly above the left of sample 152D in the 45-degree diagonal gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3a, the adjacent sample 152w, which is located immediately to the upper left of sample 152d at location L[-1, x-1], may be unavailable because it is outside the upper boundary 150b of segment 148. According to aspects of the present disclosure, in response to determining that sample 152w is unavailable, the video encoder 200 and video decoder 300 may replace the unavailable sample 152w with sample 152e, which is the other eccentric sample from the three consecutive adjacent samples 152d-152w along the 45-degree diagonal gradient direction, to determine the 45-degree diagonal gradient value of sample 152d. As shown in Figure 3a, sample 152w is replaced by the sample at location L[1, x+1], which is sample 152e.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate a 135° diagonal gradient value for sample 152z, video encoder 200 and video decoder 300 may take sample 152z at location L[0, x] as the center sample for three (3) consecutive samples along the 135° diagonal gradient direction. The other two samples of the three consecutive samples along the 135° diagonal gradient direction with sample 152z as the center sample are the adjacent sample 152h at location L[1, x-1] which is located directly below the left of sample 152z in the 135° diagonal gradient direction and the adjacent sample 152t at location L[-1, x+1] which is located directly above the right of sample 152z in the 135° diagonal gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3a, the adjacent sample 152i, which is located immediately to the upper right of sample 152z at location L[-1, x+1], may be unavailable because it is outside the upper boundary 150b of segment 148. According to aspects of the present disclosure, in response to determining that sample 152i is unavailable, the video encoder 200 and video decoder 300 may replace the unavailable sample 152i with sample 152h, which is the other eccentric sample of the three consecutive adjacent samples 152z-152i along the 135-degree diagonal gradient direction, to determine the 135-degree diagonal gradient value of sample 152z. As shown in Figure 3a, sample 152i is replaced by the sample at location L[1, x-1], which is sample 152h.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate the horizontal gradient value of sample 152i, video encoder 200 and video decoder 300 may take sample 152i at location L[0, x] as the center sample of three (3) consecutive samples along the horizontal gradient direction. The other two samples of the three consecutive samples along the horizontal direction with sample 152i as the center sample are the adjacent sample 152k at location L[0, x+1] which is immediately to the right of sample 152i in the horizontal gradient direction and the adjacent sample 152i at location L[0, x-1] which is immediately to the left of sample 152i in the horizontal gradient direction. Because all samples 152i-152l fall within segment 148 and not outside the left boundary 150a or the upper boundary 150b, video encoder 200 and video decoder 300 may not need to replace any of samples 152i-152l to calculate the horizontal gradient value of sample 152i.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Similarly, in the example in Figure 3A, if the sample is to the left of the left boundary 150A of segment 148, then the sample is not available for the purposes of determining gradient values ​​for samples in segment 148 that are along the left boundary 150A. If the video encoder 200 and the video decoder 300 determine that one of the three consecutive adjacent samples used to calculate the gradient value for a sample abutting the left boundary 150A is to the left of the left boundary 150A, the video encoder 200 and the video decoder 300 may replace the sample outside the left boundary 150A with the other off-center sample from the three consecutive adjacent samples to calculate the gradient value for the sample abutting the left boundary 150A.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">For example, to calculate the horizontal gradient value of sample 152m, video encoder 200 and video decoder 300 may take sample 152m at location L[y, 0] as the center sample of three (3) consecutive samples along the horizontal gradient direction. The other two samples of the three consecutive samples along the horizontal direction with sample 152m as the center sample are the adjacent sample 152n at location L[y, 1] which is immediately to the right of sample 152m in the horizontal gradient direction and the adjacent sample 152s at location L[y, -1] which is immediately to the left of sample 152m in the horizontal gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3a, the adjacent sample 152s, which is located immediately to the left of sample 152m at location L[y, -1], may be unavailable because it is outside the left boundary 150a of segment 148. According to aspects of the present disclosure, in response to determining that sample 152s is unavailable, the video encoder 200 and the video decoder 300 may replace the unavailable sample 152s with sample 152n, which is the other eccentric sample from the three consecutive adjacent samples 152m-152s along the horizontal gradient direction, to determine the horizontal gradient value of sample 152m. As shown in Figure 3a, sample 152s is replaced by the sample at location L[y, 1], which is sample 152n.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate a 45-degree diagonal gradient value for sample 152p, video encoder 200 and video decoder 300 may take sample 152p at location L[y, 0] as the center sample for three (3) consecutive samples along the 45-degree diagonal gradient direction. The other two samples of the three consecutive samples along the 45-degree diagonal gradient direction with sample 152p as the center sample are the adjacent sample 152p at location L[y+1, 1] which is located directly below the right of sample 152p in the 45-degree diagonal gradient direction and the adjacent sample 152p at location L[y-1, -1] which is located directly above the left of sample 152p in the 45-degree diagonal gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3a, the adjacent sample 152y, which is located immediately to the upper left of sample 152p at location L[y-1, -1], may be unavailable because it is outside the left boundary 150a of segment 148. According to aspects of the present disclosure, in response to determining that sample 152y is unavailable, the video encoder 200 and the video decoder 300 may replace the unavailable sample 152y with sample 152f, which is the other eccentric sample of the three consecutive adjacent samples 152p-152p along the 45-degree diagonal gradient direction, to determine the 45-degree diagonal gradient value of sample 152p. As shown in Figure 3a, sample 152y is replaced by the sample at location L[y+1, 1], which is sample 152f.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate a 135° diagonal gradient value for sample 152q, video encoder 200 and video decoder 300 may take sample 152q at location L[y, 0] as the center sample for three (3) consecutive samples along the 135° diagonal gradient direction. The other two samples of the three consecutive samples along the 135° diagonal gradient direction with sample 152q as the center sample are the adjacent sample 152u at location L[y-1, 1] which is located directly to the top right of sample 152q in the 135° diagonal gradient direction and the adjacent sample 152r at location L[y+1, -1] which is located directly to the bottom left of sample 152q in the 135° diagonal gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3a, the adjacent sample 152r, which is located immediately below the left of sample 152q at location L[y+1, -1], may be unavailable because it is outside the left boundary 150a of segment 148. According to aspects of the present disclosure, in response to determining that sample 152r is unavailable, the video encoder 200 and the video decoder 300 may replace the unavailable sample 152r with sample 152u, which is the other eccentric sample from the three consecutive adjacent samples 152u-152u along the 135-degree diagonal gradient direction, to determine the 135-degree diagonal gradient value of sample 152q. As shown in Figure 3a, sample 152r is replaced by the sample at location L[y-1, 1], which is sample 152u.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate the vertical gradient value of sample 152i, video encoder 200 and video decoder 300 may take sample 152t at location L[y, 0] as the center sample of three (3) consecutive samples along the vertical gradient direction. The other two samples of the three consecutive samples along the vertical direction with sample 152t as the center sample are the adjacent sample 152s at location L[y+1, 0] which is directly below sample 152t in the vertical gradient direction and the adjacent sample 152x at location L[y-1, 0] which is directly above sample 152t in the vertical gradient direction. Because all samples 152T-152F fall within segment 148 and not outside the left boundary 150A or the upper boundary 150B, video encoder 200 and video decoder 300 may not need to replace any of the samples 152T-152F to calculate the vertical gradient value of sample 152T.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">According to some aspects of the present disclosure, instead of replacing unavailable samples that are out of bounds, such as outside the left boundary 150a or the upper boundary 150b, with samples in the same gradient direction, the video encoder 200 and the video decoder 300 may, for the purposes of calculating the gradient values ​​of the samples, use mirror padding to replace the sample values ​​of unavailable samples that are out of bounds with the sample values ​​of adjacent available samples. Mirror padding may refer to a process whereby the video encoder 200 and the video decoder 300 invert the sample values ​​near the current boundary of a segment rather than, i.e., replace the actual sample values ​​of the unavailable sample.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">If the unavailable sample abuts a horizontal boundary, such as the upper boundary 150b, the video encoder 200 and the video decoder 300 may perform mirror padding to replace the sample value of the unavailable sample with the sample value of a sample on the same column as the unavailable sample that is within the horizontal boundary. In particular, the video encoder 200 and the video decoder 300 may determine that the unavailable sample is a vertical distance from a sample on the same column that abuts the horizontal boundary. The video encoder 200 and the video decoder 300 may determine that an available sample on the same column as the unavailable sample is an equal vertical distance from the sample on the same column that abuts the horizontal boundary but in the opposite direction from the sample on the same column that abuts the horizontal boundary. The video encoder 200 and the video decoder 300 may replace the sample values ​​of the unavailable sample with the sample values ​​of an available sample on the same column that is an equal vertical distance as the unavailable sample in the opposite direction from the sample on the same column that abuts the horizontal boundary.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In the example in Figure 3b, in the coordinate system L[y, x], given a sample at L[-1, 4] that is outside the upper boundary 150b and therefore unavailable, the video encoder 200 and the video decoder 300 may determine the vertical distance between the unavailable sample and a sample on the same column that abuts the upper boundary 150b at L[0, 4] as the vertical distance of one of them. The video encoder 200 and the video decoder 300 may determine that the sample at L[1, 4] is a sample on the same column and is an equal vertical distance in the other direction from the sample at L[0, 4] and may replace the sample values ​​of the unavailable sample at L[-1, 4] with the sample values ​​of the sample at L[1, 4], thus performing mirror filling of the unavailable sample at L[-1, 4].<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">For example, to calculate the vertical gradient value of sample 152a, video encoder 200 and video decoder 300 may take sample 152a at location L[0, x] as the center sample of three (3) consecutive samples along the vertical gradient direction. The other two samples of the three consecutive samples along the vertical direction with sample 152a as the center sample are the adjacent sample 152b at location L[1, x] which is directly below sample 152a in the vertical gradient direction and the adjacent sample 152c at location L[-1, x] which is directly above sample 152a in the vertical gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3B, the adjacent sample 152C that is located directly above the sample 152A at location L[-1, x] may be unavailable because it is located outside the upper boundary 150B of the segment 148. In accordance with aspects of the present disclosure, in response to determining that the sample 152C is unavailable, the video encoder 200 and the video decoder 300 may perform mirror filling to replace the unavailable sample 152C. In particular, the video encoder 200 and the video decoder 300 may determine that the sample 152B at location L[-1, x] is the sample that is located within the upper boundary 150B and is on the same column as the unavailable sample 152B and is at an equal vertical distance as the unavailable sample 152C in the opposite direction from the sample 152A at location L[0, x] on the same column that is abutting the upper boundary 150B. As such, sample 152c is replaced by the sample at location L[1, x], which is sample 152b.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate a 45-degree diagonal gradient value for sample 152D, video encoder 200 and video decoder 300 may take sample 152D at location L[0, x] as the center sample for three (3) consecutive samples along the 45-degree diagonal gradient direction. The other two samples of the three consecutive samples along the 45-degree diagonal gradient direction with sample 152D as the center sample are the adjacent sample 152E at location L[1, x+1] which is located directly below the right of sample 152D in the 45-degree diagonal gradient direction and the adjacent sample 152F at location L[-1, x-1] which is located directly above the left of sample 152D in the 45-degree diagonal gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3B, the adjacent sample 152w that is located immediately to the upper left of sample 152d at location L[-1, x-1] may be unavailable because it is outside the upper boundary 150b of segment 148. In accordance with aspects of the present disclosure, in response to determining that sample 152w is unavailable, the video encoder 200 and the video decoder 300 may perform mirror filling to replace the unavailable sample 152w. In particular, the video encoder 200 and the video decoder 300 may determine that sample 153a at location L[1, x-1] is the sample that is located within the upper boundary 150b and is on the same column as the unavailable sample 152w and is at an equal vertical distance as the unavailable sample 152w in the opposite direction from the sample at location L[0, x-1] on the same column that is abutting the upper boundary 150b. As such, sample 152 is replaced by the sample at location L[1, x-1], which is sample 153a.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate a 135° diagonal gradient value for sample 152z, video encoder 200 and video decoder 300 may take sample 152z at location L[0, x] as the center sample for three (3) consecutive samples along the 135° diagonal gradient direction. The other two samples of the three consecutive samples along the 135° diagonal gradient direction with sample 152z as the center sample are the adjacent sample 152h at location L[1, x-1] which is located directly below the left of sample 152z in the 135° diagonal gradient direction and the adjacent sample 152t at location L[-1, x+1] which is located directly above the right of sample 152z in the 135° diagonal gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3B, the adjacent sample 152i that is located immediately to the upper right of sample 152z at location L[-1, x+1] may be unavailable because it is outside the upper boundary 150b of segment 148. In accordance with aspects of the present disclosure, in response to determining that sample 152i is unavailable, the video encoder 200 and the video decoder 300 may perform mirror stuffing to replace the unavailable sample 152i. In particular, the video encoder 200 and the video decoder 300 may determine that sample 153b at location L[1, x+1] is the sample that is located within the upper boundary 150b and is on the same column as the unavailable sample 152i and is at an equal vertical distance as the unavailable sample 152i in the opposite direction from the sample at location L[0, x+1] on the same column that is abutting the upper boundary 150b. As such, sample 152i is replaced by the sample at location L[1, x+1], which is sample 153b.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate the horizontal gradient value of sample 152i, video encoder 200 and video decoder 300 may take sample 152i at location L[0, x] as the center sample of three (3) consecutive samples along the horizontal gradient direction. The other two samples of the three consecutive samples along the horizontal direction with sample 152i as the center sample are the adjacent sample 152k at location L[0, x+1] which is immediately to the right of sample 152i in the horizontal gradient direction and the adjacent sample 152i at location L[0, x-1] which is immediately to the left of sample 152i in the horizontal gradient direction. Because all samples 152i-152l fall within segment 148 and not outside the left boundary 150a or the upper boundary 150b, video encoder 200 and video decoder 300 may not need to replace any of samples 152i-152l to calculate the horizontal gradient value of sample 152i.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Similarly, if the unavailable sample abuts a vertical boundary, such as the left boundary 150a, the video encoder 200 and the video decoder 300 may perform mirror padding to replace the sample value of the unavailable sample with the sample value of a sample on the same row as the unavailable sample that is within the vertical boundary. In particular, the video encoder 200 and the video decoder 300 may determine a horizontal distance for the unavailable sample from a sample on the same row that abuts the vertical boundary. The video encoder 200 and the video decoder 300 may determine a sample on the same row as the unavailable sample that is an equal horizontal distance from the sample on the same row that abuts the vertical boundary but in the opposite direction from the sample on the same row that abuts the vertical boundary. The video encoder 200 and the video decoder 300 may replace the unavailable sample with the sample values ​​of the available sample on the same row that are an equal horizontal distance as the unavailable sample in the other direction from the sample on the same column that abuts the vertical boundary in the other direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In the example of Figure 3b, in the coordinate system L[y, x], given a sample at L[y, -1] that is outside the left boundary 150a and therefore unavailable, the video encoder 200 and the video decoder 300 may determine the horizontal distance between the unavailable sample and a sample on the same row that abuts the left boundary 150a at L[y, 0] as the horizontal distance of one of them. The video encoder 200 and the video decoder 300 may determine that the sample at L[y, 1] is a sample on the same row and is an equal horizontal distance in the other direction from the sample at L[y, 0] and may replace the sample values ​​of the unavailable sample at L[y, -1] with the sample values ​​of the sample at L[y, 1], thus performing mirror filling of the unavailable sample at L[y, -1].<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">For example, to calculate the horizontal gradient value of sample 152m, video encoder 200 and video decoder 300 may take sample 152m at location L[y, 0] as the center sample of three (3) consecutive samples along the horizontal gradient direction. The other two samples of the three consecutive samples along the horizontal direction with sample 152m as the center sample are the adjacent sample 152n at location L[y, 1] which is immediately to the right of sample 152m in the horizontal gradient direction and the adjacent sample 152s at location L[y, -1] which is immediately to the left of sample 152m in the horizontal gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3B, the adjacent sample 152S that is located immediately to the left of sample 152M at location L[y, -1] may be unavailable because it is outside the left boundary 150A of segment 148. In accordance with aspects of the present disclosure, in response to determining that sample 152S is unavailable, the video encoder 200 and the video decoder 300 may perform mirror filling to replace the unavailable sample 152S. In particular, the video encoder 200 and the video decoder 300 may determine that sample 152N at location L[y, 1] is the sample that is located within the left boundary 150A and is on the same row as the unavailable sample 152S and is at an equal vertical distance as the unavailable sample 152T in the opposite direction from the sample at location L[y, 0] on the same row that abuts the left boundary 150A. As such, sample 152s is replaced by the sample at location L[y, 1], which is sample 152n.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate a 45-degree diagonal gradient value for sample 152p, video encoder 200 and video decoder 300 may take sample 152p at location L[y, 0] as the center sample for three (3) consecutive samples along the 45-degree diagonal gradient direction. The other two samples of the three consecutive samples along the 45-degree diagonal gradient direction with sample 152p as the center sample are the adjacent sample 152p at location L[y+1, 1] which is located directly below the right of sample 152p in the 45-degree diagonal gradient direction and the adjacent sample 152p at location L[y-1, -1] which is located directly above the left of sample 152p in the 45-degree diagonal gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3B, the adjacent sample 152y that is located immediately to the upper left of sample 152p at location L[y-1, -1] may be unavailable because it is outside the left boundary 150a of segment 148. In accordance with aspects of the present disclosure, in response to determining that sample 152y is unavailable, the video encoder 200 and the video decoder 300 may perform mirror filling to replace the unavailable sample 152y. In particular, the video encoder 200 and the video decoder 300 may determine that sample 154c at location L[y-1, 1] is the sample that is located within the left boundary 150a and is on the same row as the unavailable sample 152y and is at an equal vertical distance as the unavailable sample 152y in the opposite direction from the sample at location L[y-1, 0] on the same row that abuts the left boundary 150a. As such, sample 152y is replaced by the sample at location L[y-1, 1], which is sample 154c.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate a 135° diagonal gradient value for sample 152q, video encoder 200 and video decoder 300 may take sample 152q at location L[y, 0] as the center sample for three (3) consecutive samples along the 135° diagonal gradient direction. The other two samples of the three consecutive samples along the 135° diagonal gradient direction with sample 152q as the center sample are the adjacent sample 152u at location L[y-1, 1] which is located directly to the top right of sample 152q in the 135° diagonal gradient direction and the adjacent sample 152r at location L[y+1, -1] which is located directly to the bottom left of sample 152q in the 135° diagonal gradient direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, as shown in Figure 3B, the adjacent sample 152r that is located immediately below the left of sample 152q at location L[y+1, -1] may be unavailable because it is outside the left boundary 150a of segment 148. In accordance with aspects of the present disclosure, in response to determining that sample 152r is unavailable, the video encoder 200 and the video decoder 300 may perform mirror filling to replace the unavailable sample 152r. In particular, the video encoder 200 and the video decoder 300 may determine that sample 154d at location L[y+1, 1] is the sample that is located within the left boundary 150a and is on the same row as the unavailable sample 152r and is at an equal vertical distance as the unavailable sample 152r in the opposite direction from the sample at location L[y+1, 0] on the same row that abuts the left boundary 150a. Thus, sample 152r is replaced by the sample at location L[y+1, 1], which is sample 154d.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, to calculate the vertical gradient value of sample 152i, video encoder 200 and video decoder 300 may take sample 152t at location L[y, 0] as the center sample of three (3) consecutive samples along the vertical gradient direction. The other two samples of the three consecutive samples along the vertical direction with sample 152t as the center sample are the adjacent sample 152s at location L[y+1, 0] which is directly below sample 152t in the vertical gradient direction and the adjacent sample 152x at location L[y-1, 0] which is directly above sample 152t in the vertical gradient direction. Because all samples 152T-152F fall within segment 148 and not outside the left boundary 150A or the upper boundary 150B, video encoder 200 and video decoder 300 may not need to replace any of the samples 152T-152F to calculate the vertical gradient value of sample 152T.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, as described above, to perform ALF, the video encoder 200 and the video decoder 300 may determine sample classifications based at least in part on the gradient values ​​of the samples, such as those determined using the techniques described in Figures 3A and 3B. In particular, the video encoder 200 and the video decoder 300 may be configured to select one of a set of AFL classes to apply to a video data segment (e.g., a segment of luma and / or chroma samples) based on the gradient values. In some examples, the video encoder 200 and the video decoder 300 are configured to apply classification to each 4×4 luma segment. The video encoder 200 and the video decoder 300 may be configured to classify each 4×4 segment into one of 25 classes based on the specified directionality and quantized activity value of the segment in order to select a twin-ring filter for each segment. Details are described as follows.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Video encoder 200 and video decoder 300 may be configured to determine the ALF classification of a clip based on the 1D Laplacian orientation of the clip samples and the 2D Laplacian activity of the clip samples for each 4×4 luma clip. In one example, video encoder 200 and video decoder 300 may be configured to calculate the sum of the gradients of each two samples within an 8×8 window spanning the 4×4 luma clip to determine the gradient values ​​for the clip. Video encoder 200 and video decoder 300 may be configured to calculate four gradient values: a vertical gradient value denoted gv, a horizontal gradient value denoted gh, a 135-degree radial gradient value denoted gd1, and a 45-degree radial gradient value denoted gd2.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> As shown in Figure 4A, the video encoder 200 and the video decoder 300 can calculate the gradient value (represented in Figure 4A by "D1") for samples in the 8×8 region. Calculating the gradient values ​​for a sample may include calculating the values ​​for the vertical gradient, the horizontal gradient, the 45-degree diagonal gradient, and the 135-degree diagonal gradient for the same sample.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the video encoder and video decoder 300 can calculate gradient values ​​for all samples in the 8×8 region or for less than all samples in the 8×8 region. For example, to calculate gradient values ​​for less than all samples in the 8×8 region, the video encoder 200 and video decoder 300 can calculate the gradient value for each of the two samples in the 8×8 region, as shown in Figure 4A, rather than for each sample in the 8×8 region. Determining the gradient value for less than all samples (e.g., for each of the two samples) in the 8×8 region, as opposed to determining the gradient value for each sample in the 8×8 region, may, in some examples, be referred to as “subsampling,” and the gradient values ​​determined for less than all samples in the 8×8 region may be referred to as “subsampling gradients.”<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In the current VVC, a 4×4 segment, such as segment 170, shown as shaded in Figure 4a, collects subsampled gradients in the surrounding 8×8 window, such as region 172. The portions of region 172 outside segment 170 are shown as unshaded in Figure 4a. In one example, video encoder 200 and video decoder 300 define the activity of segment 170 as the sum of the vertical and horizontal gradients over region 172. Video encoder 200 and video decoder 300 estimate this value to obtain five activity values. Also, video encoder 200 and video decoder 300 determine the dominant gradient direction within segment 170 by comparing the directional gradients and additionally determine the strength of the direction, yielding five direction values. Together, these two features yield 25 classes.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">However, portions of region 172 that are outside of segment 170 may also extend beyond the horizontal boundary or vertical boundary of segment 170, and therefore gradients outside of the horizontal boundary or vertical boundary of segment 170 may not be available for determining the sum of gradients above region 172. For example, portions of region 172 outside of segment 170 that are on the other side of the horizontal boundary or vertical boundary of segment 170 extend beyond the horizontal boundary or vertical boundary. Examples of horizontal boundaries and vertical boundaries may include an image boundary, a slide boundary, a panel boundary, a panel group boundary, and the like, as discussed throughout this disclosure. As such, aspects of the present disclosure apply to boundaries outside of the CTU, such as an image boundary (i.e., a video data frame boundary) or a virtual boundary.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">One potential overcoming technique for this problem involves using padded samples to determine gradients for unavailable samples. For example, for the current sample A in segment 170, if the video encoder 200 and video decoder 300 need sample B that lies on the other side of the horizontal or vertical boundary relative to sample A, the video encoder 200 and video decoder 300 may replace the value of sample B with the sample closest to sample B on the side of sample A within segment 170. These replaced samples may be referred to as padded samples. However, these techniques can potentially result in a loss of subjective and / or objective quality. For example, padding can introduce discontinuities in the reconstructed video data that might not otherwise appear to contain the actual sample values ​​used.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">According to aspects of the present disclosure, instead of using padded samples to replace gradients that fall outside the boundaries of an image, slice, panel, or group of panels, those gradients are replaced by gradients within the boundaries of the image, slice, panel, or group of panels. In some examples, gradients that fall outside a boundary may be replaced by gradients that fall inside a boundary, even if the gradients within the boundary are outside the 4×4 170 segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> As shown in Figure 4B, if the gradient is outside the horizontal boundary 174 of an image, slice, plate, or set of plates, the closest gradient on the same column for the image, slice, plate, or set of plates is used. In particular, samples 160a-160h are outside the horizontal boundary 174 because samples 160a-160h lie on the other side of the horizontal boundary 174 of the section 170. As such, the gradients for samples 160a-160h are unavailable for classification of the section 170 based at least in part on the gradients of the subsamples accumulated in the surrounding 8×8 region 172 of the section 170.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In accordance with aspects of the present disclosure, the video encoder 200 and the video decoder 300 may replace the gradients in region 172 that are outside the horizontal boundary 174 with the closest gradient in the same column in region 172 that is located inside the horizontal boundary 174 (i.e., on the same side of the horizontal boundary 174 as the segment 170). Thus, in the example of Figure 4B, the video encoder 200 and the video decoder 300 may replace the gradient for sample 160a that is located outside the horizontal boundary 174 with the gradient for sample 160i that is located inside the horizontal boundary 174, as shown by the arrow pointing from sample 160i to sample 160a. The video encoder 200 and the video decoder 300 may replace the gradient of sample 160H which is outside the horizontal boundary 174 with the gradient of sample 160K which is inside the horizontal boundary 174, as shown by the arrow pointing from sample 160K to sample 160H.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Video encoder 200 and video decoder 300 may replace the gradient of sample 160b that is outside the horizontal boundary 174 with the gradient of sample 162a that is inside the horizontal boundary 174, as shown by the arrow pointing from sample 162a to sample 160b. Video encoder 200 and video decoder 300 may also replace the gradient of sample 160f that is outside the horizontal boundary 174 with the gradient of sample 162c that is inside the horizontal boundary 174, as shown by the arrow pointing from sample 162c to sample 160f. Video encoder 200 and video decoder 300 may also replace the gradient of sample 160c that is outside the horizontal boundary 174 with the gradient of sample 162b that is inside the horizontal boundary 174, as shown by the arrow pointing from sample 162b to sample 160c. Video encoder 200 and video decoder 300 may also replace the gradient of sample 160z that lies outside the horizontal boundary 174 with the gradient of sample 162d that lies inside the horizontal boundary 174, as shown by the arrow pointing from sample 162d to sample 160z.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Video encoder 200 and video decoder 300 may also replace the gradient of sample 160D that is outside the horizontal boundary 174 with the gradient of sample 160Y that is inside the horizontal boundary 174, as shown by the arrow pointing from sample 160Y to sample 160D. Video encoder 200 and video decoder 300 may also replace the gradient of sample 160H that is outside the horizontal boundary 174 with the gradient of sample 160L that is inside the horizontal boundary 174, as shown by the arrow pointing from sample 160L to sample 160H.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As shown in Figure 4C, if the gradient is outside the vertical boundary 176, the closest gradient on the same row in the image, slice, plate, or set of plates bounded by the vertical boundary 176 is used. In particular, sample 160A, sample 160E, sample 160T, sample 160K, sample 160M, sample 160S, sample 160F, and sample 160U lie outside the vertical boundary 176 because sample 160A, sample 160E, sample 160T, sample 160K, sample 160M, sample 160S, sample 160F, and sample 160U lie on the other side of the vertical boundary 176 of the section 170. As such, the gradients for sample 160A, sample 160E, sample 160T, sample 160K, sample 160M, Sample 160S, Sample 160F, and Sample 160U are not available for classification of section 170 based at least in part on the gradients of the accumulated subsamples in the 8×8 172 surrounding region of section 170.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In accordance with aspects of the present disclosure, the video encoder 200 and the video decoder 300 may replace the gradients in region 172 that are outside the vertical boundary 176 with the closest gradient in the same row in region 172 that is inside the vertical boundary 176 (i.e., on the same side of the vertical boundary 176 as the segment 170). Thus, in the example of Figure 4C, the video encoder 200 and the video decoder 300 may replace the gradient for sample 160a that is outside the vertical boundary 176 with the gradient for sample 160b that is inside the vertical boundary 176, as shown by the arrow pointing from sample 160b to sample 160a. The video encoder 200 and the video decoder 300 may replace the gradient of sample 160H which is outside the vertical boundary 176 with the gradient of sample 160W which is inside the vertical boundary 176, as shown by the arrow pointing from sample 160W to sample 160H.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Video encoder 200 and video decoder 300 may replace the gradient of sample 160i that is outside the vertical boundary 176 with the gradient of sample 162a that is inside the vertical boundary 176, as shown by the arrow pointing from sample 162a to sample 160i. Video encoder 200 and video decoder 300 may also replace the gradient of sample 160k that is outside the vertical boundary 176 with the gradient of sample 162c that is inside the vertical boundary 176, as shown by the arrow pointing from sample 162c to sample 160k. Video encoder 200 and video decoder 300 may also replace the gradient of sample 160m that is outside the vertical boundary 176 with the gradient of sample 162e that is inside the vertical boundary 176, as shown by the arrow pointing from sample 162e to sample 160m. Video encoder 200 and video decoder 300 may also replace the gradient of sample 160s that is outside the vertical boundary 176 with the gradient of sample 162z that is inside the vertical boundary 176, as shown by the arrow pointing from sample 162z to sample 160s.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Video encoder 200 and video decoder 300 may also replace the gradient of sample 160F that is outside the vertical boundary 176 with the gradient of sample 160Y that is inside the vertical boundary 176, as shown by the arrow pointing from sample 160Y to sample 160F. Video encoder 200 and video decoder 300 may also replace the gradient of sample 160U that is outside the vertical boundary 176 with the gradient of sample 160T that is inside the vertical boundary 176, as shown by the arrow pointing from sample 160T to sample 160U.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, the video encoder 200 and the video decoder 300 may compute additional gradients in the image, slice, palette, or set of palettes to replace unavailable gradients that fall outside the image, slice, palette, or set of palettes. As discussed above, the video encoder 200 and the video decoder 300 may compute a gradient for each of the two samples in the 8×8 region 172, including computing a gradient for each of the two samples in the segment 170, thus computing the gradients for eight of the sixteen samples in the segment 170. Also, as shown in Figures 5B and C, both the horizontal boundary 174 and the vertical boundary 176 may cause the eight gradients in the region 172 that fall outside the horizontal boundary 174 or the vertical boundary 176 to be unavailable. As such, the video encoder 200 and the video decoder 300 may replace the eight unavailable gradients by computing eight additional gradients for the eight additional samples in the segment 170.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As shown in Figure 4D, samples 160A-160H lie outside the horizontal boundary 174 because samples 160A-160H are on the other side of the horizontal boundary 174 from section 170. As such, the gradients of samples 160A-160H are not available for classification of section 170 based at least in part on the gradients of the subsamples accumulated in the 8×8 172 surrounding region of section 170.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In accordance with aspects of the present disclosure, when calculating the sub-samples' gradient values, the video encoder 200 and the video decoder 300 may replace the unavailable gradients by calculating eight additional gradients for eight samples in segment 170. For example, the video encoder 200 and the video decoder 300 may calculate the gradients for samples 162i-162i within segment 170, and may use the gradients for samples 162i-162i in place of the unavailable gradients for samples 160a-160h to perform the segment 170 classification process.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Similarly, as shown in Figure 4E, sample 160A, sample 160E, sample 160T, sample 160K, sample 160M, sample 160S, sample 160F, and sample 160U lie outside the vertical boundary 176 because sample 160A, sample 160E, sample 160T, sample 160K, sample 160M, sample 160S, sample 160F, and sample 160U lie on the other side of the vertical boundary 176 from section 170. As such, the gradients for sample 160A, sample 160E, sample 160T, sample 160K, sample 160M, sample 160S, sample 160F, and sample 160U are not available for section 170 classification based at least in part on the gradients of the accumulated subsamples. In the area surrounding 8x8 172 of section 170.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In accordance with aspects of the present disclosure, when calculating the sub-samples' gradient values, the video encoder 200 and the video decoder 300 may replace the unavailable gradients by calculating eight additional gradients for eight samples in segment 170. For example, the video encoder 200 and the video decoder 300 may calculate the gradients for samples 162i-162p within segment 170,<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Gradients for samples 162T-162A may be used instead of the unavailable gradients for sample 160A, sample 160E, sample 160T, sample 160K, sample 160M, sample 160S, sample 160F, and sample 160S to perform the section 170 classification.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In another example, if the gradient is outside the bounds, the closest gradient with the same direction as the gradient in the image, slide, canvas, or canvas group is used. This can apply to horizontal gradients, vertical gradients, and radial gradients.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> As shown in Figure 4, region 172 may include 135-degree diagonal gradients denoted "D1." As such, gradients that fall outside a boundary may be replaced by the nearest gradient in the same 135-degree diagonal direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In Figure 4F, for area 172 with horizontal boundary 174, samples 160A-160H lie outside the horizontal boundary 174 because samples 160A-160H lie on the other side of the horizontal boundary 174 from section 170. As such, the gradients for samples 160A-160H are not available for classification of section 170 based at least in part on the gradients of the subsamples accumulated in the surrounding 8×8 area 172 of section 170.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In accordance with aspects of the present disclosure, the video encoder 200 and the video decoder 300 may replace the gradients in region 172 that are outside the horizontal boundary 174 with a gradient that is closest in the same direction as the gradient in region 172 that is inside the horizontal boundary 174 (i.e., on the same side of the horizontal boundary 174 as the segment 170).<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Whereas Figure 4W shows that region 172 contains the 135-degree diagonal gradients each denoted “D1,” each of the gradients not available for samples 160a-160h is a 135-degree diagonal gradient, and video encoder 200 and video decoder 300 may replace each of the gradients not available for samples 160a-160h with the nearest available gradient along the 135-degree diagonal gradients.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Specimen 162A lies along the same 135° diagonal direction as specimens 160A and 160E. Therefore, the 135° diagonal gradients of both specimen 160A and 160E can be replaced by the 135° diagonal gradient of specimen 162A, as shown by the arrow pointing from specimen 162A through specimens 160A and 160E.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Specimen 162B lies along the same 135° diagonal direction as specimens 160B and 160W. Therefore, the 135° diagonal gradients of both specimen 160B and specimen 160W can be replaced by the 135° diagonal gradient of specimen 162B, as shown by the arrow pointing from specimen 162B through specimens 160B and 160W.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Specimen 160Y lies along the same 135° diagonal direction as specimens 160C and 160Z. Therefore, the 135° diagonal gradients for both specimen 160C and 160Z can be replaced by the 135° diagonal gradient for specimen 160Y, as shown by the arrow pointing from specimen 160Y through specimens 160C and 160Z.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> As shown in Figure 4g, region 172 may also include 45-degree diagonal gradients denoted "D2." As such, gradients that fall outside a boundary may be replaced by the nearest gradient in the same 45-degree diagonal direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In Figure 4g, for area 172 with horizontal boundary 174, samples 160a-160h lie outside the horizontal boundary 174 because samples 160a-160h lie on the other side of the horizontal boundary 174 from section 170. As such, the gradients for samples 160a-160h are not available for classification of section 170 based at least in part on the gradients of the subsamples accumulated in the surrounding 8×8 area 172 of section 170.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In accordance with aspects of the present disclosure, the video encoder 200 and the video decoder 300 may replace the gradients in region 172 that are outside the horizontal boundary 174 with a gradient that is closest in the same direction as the gradient in region 172 that is inside the horizontal boundary 174 (i.e., on the same side of the horizontal boundary 174 as the segment 170).<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Whereas Figure 4g shows that region 172 contains the 45-degree diagonal gradients each denoted "D2", each of the gradients not available for samples 160a-160h is a 45-degree diagonal gradient, and video encoder 200 and video decoder 300 may replace each of the gradients not available for samples 160a-160h with the nearest available gradient along the 45-degree diagonal gradients.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Specimen 160T lies along the same 45° diagonal direction as specimens 160B and 160E. Therefore, the 45° diagonal gradients of both specimen 160B and 160E can be replaced by the 45° diagonal gradient of specimen 160T, as shown by the arrow pointing from specimen 160T through specimens 160B and 160E.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Specimen 162A lies along the same 45° diagonal direction as specimens 160C and 160F. Therefore, the 45° diagonal gradients of both specimen 160C and 160F can be replaced by the 45° diagonal gradient of specimen 162A, as shown by the arrow pointing from specimen 162A through specimens 160C and 160F.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Specimen 162B lies along the same 45° diagonal direction as specimens 160D and 160Z. Therefore, the 45° diagonal gradients of both specimen 160D and 160Z can be replaced by the 45° diagonal gradient of specimen 162B, as shown by the arrow pointing from specimen 162B through specimens 160D and 160Z.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Specimen 160Y lies along the same 135° diagonal direction as specimen 160H. Therefore, the 45° diagonal gradient of specimen 160H can be replaced by the 45° diagonal gradient of specimen 160Y, as shown by the arrow pointing from specimen 160Y to specimen 160H.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In another example, video encoder 200 and video decoder 300 may refrain from calculating gradients that fall outside an image / slide / panel / group of panels. Instead, video encoder 200 and video decoder 300 may perform classification of segment 170 using fewer than all subsampled gradients in region 172.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As shown in Figure 4H, for region 172 with horizontal boundary 174, samples 160A-160H lie outside the horizontal boundary 174 because samples 160A-160H lie on the other side of the horizontal boundary 174 from segment 170. As such, the gradients for samples 160A-160H are unavailable for segment 170 classification based at least in part on the gradients of the subsamples accumulated in the 8×8 surrounding region 172 of segment 170. Therefore, video encoder 200 and video decoder 300 may refrain from determining the gradients for samples 160A-160H. Instead, video encoder 200 and video decoder 300 may compute the gradients for samples 160I-160H and samples 162A-162H for segment 170 classification.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> As the number of gradients changes, video encoder 200 and video decoder 300 renormalize the activity and calculate the classification. In particular, because video encoder 200 and video decoder 300 in the example in Figure 4h do not calculate gradients for the eight unavailable samples, video encoder 200 and video decoder 300 may calculate gradients for 24 samples in region 172 instead of 32 samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In one embodiment, to determine gradient (g) values, the video encoder 200 and the video decoder 300 may be configured to determine a vertical gradient (gv), a horizontal gradient (gh), a 135-degree diagonal gradient (gd1), and a 45-degree diagonal gradient (gd2). Further, to scale the gradient (g) values ​​based on the scaling factor to produce the measured gradient (g'), the video encoder 200 and the video decoder 300 may scale the gradient (g) values ​​using the following equation: g' = g / number of available samples * number of full samples, where the number of available samples represents the number of samples in the window that are not padded (e.g., the number of available samples in the window that are on the same side of the vertical boundary as the reconstructed segment), and the number of full samples represents the total number of samples in the window. For example, in the example of Figure 4h where gradients for 8 samples are not available, the number of available samples may be 24 and the number of full samples may be 32.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As described above, the video encoder 200 and the video decoder 300 may determine a twin-loop filter for a reconstructed video data segment, such as segment 170, based on subsampled gradients computed in a surrounding window, such as region 172, as described in connection with Figures 4A-4H. In one example, the video encoder 200 and the video decoder 300 may determine the directionality and activity index of the segment based on subsampled gradients computed in a surrounding window, and may determine a twin-loop filter for the segment based on the directionality and activity index of the segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Figure 5 illustrates an analog twin-loop filter. For example, video encoder 200 and video decoder 300 may select an analog twin-loop filter based on the twin-loop filter class of a reconstructed video data segment, such as segment 170 as shown in Figure 5. Filter 184 may be a symmetric filter, such as a 7×7 rhombus filter. In other examples, the techniques may equally apply to any other symmetric filters, such as a 5×5 rhombus filter, a 9×9 rhombus filter, and the like, including rectangular filters, octagons, crossover filters, X-shaped filters, T-shaped filters, or any other symmetric filters. Filter supports 180a of filter 184 correspond to samples that fall within the horizontal boundary 182 and, therefore, may be available while filter supports 180b of filter 184 correspond to samples that fall outside the horizontal boundary 182 and, therefore, may not be available.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In one example, the video encoder 200 and the video decoder 300 may use asymmetric partial filters to filter samples of a reconstructed video data clip. In this case, the video encoder 200 and the video decoder 300 may only filter stops corresponding to the samples available for sample filtering, thus skipping the filtering of stops for which the corresponding samples are unavailable. The video encoder 200 and the video decoder 300 may perform renormalization by skipping the filtering of stops for which the corresponding samples are unavailable, as described below.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In accordance with aspects of the present disclosure, a video coder may use the available filter supports 180a of filter 184 as an asymmetric partial filter, which the video encoder 200 and the video decoder 300 may apply to the reconstructed samples to generate candidate samples, as part of the ALF procedure. Using the available filter supports 180a of filter 184, the video encoder 200 and the video decoder 300 may skip filtering of plugs for which the corresponding samples are unavailable, such as in the filter supports 180b. A partial filter is one that does not employ one or more of the filtering parameters typically used in the filtering process. In this way, a filter may be generated from the available samples of the filters while skipping filtering of plugs for which the corresponding samples are unavailable. The video encoder 200 and the video decoder 300 may renormalize the asymmetric partial filter.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Normally, the filter coefficients of the selected filter are equal to one (meaning that the filter coefficients are normalized) so that no video data is added or removed during the filter application. By skipping or removing the filter coefficients of the selected filter to define the subfilter (also called a "partial" filter because one or more filter coefficients are removed from the originally selected filter), the resulting subfilter becomes non-normalized (meaning that the filter coefficients of the subfilter are not equal to one). As a result, the video encoder 200 and the video decoder 300 may renormalize the set of filter coefficients contained within the subfilter so that the filter coefficients are equal to one, such as by measuring each of the filter coefficients within the subfilter. The video encoder 200 and the video decoder 300 may then apply the renormalized subfilter near the boundary of the first video data segment to generate the first filtered video data segment.<h2 style=";text-align:left;direction:ltr">The video encoder 200 and the video decoder 300 may store this first candidate video data segment for use as reference video data in reconstructing other video data segments. The video encoder 200 and the video decoder 300 may apply the generative filter, for example, to samples in a reconstructed video data segment, such as segment 170, to generate the candidate samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In one example, the video encoder 200 and the video decoder 300 may use mirror sample padding to replace filter coefficients corresponding to unavailable samples with filter coefficients corresponding to available samples. In mirror padding, the filter supports of a corresponding filter (e.g., of the same size and shape, when flipped) for the unavailable samples may be replaced with filter supports corresponding to the filter corresponding to the available samples. In the example of Figure 5, the video encoder 200 and the video decoder 300 may generate a corresponding filter by performing mirror padding to replace, for example, the filter supports 180b for the filter 184 corresponding to the available samples, such that the filter coefficients in the filter supports 180c are used in place of the filter coefficients of the filter supports 180b. The video encoder 200 and the video decoder 300 may apply the generated filter, for example, to the samples in a reconstructed video data clip, such as in clip 170, to generate the candidate samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, the video encoder 200 and the video decoder 300 may use symmetric subfilters to filter a video data segment. In this case, the video encoder 200 and the video decoder 300 may not only skip filtering of blocks for which the corresponding samples are unavailable, but the video encoder 200 and the video decoder 300 may also skip one or more block filtering operations corresponding to the available samples in order to generate a symmetric subfilter. The video encoder 200 and the video decoder 300 may perform renormalization due to skipping block filtering, as described above.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Figure 6 illustrates an exemplary twin-ring filter. As shown in Figure 6, the filter supports 190a of filter 194 are within the horizontal boundary 192 while the filter supports 190b of filter 194 are outside the horizontal boundary 192 and, therefore, may be unavailable. In accordance with aspects of the present disclosure, a video programmer may use the available filter supports 190a of filter 194 to generate a symmetrical partial filter. In particular, the video programmer may identify a symmetrical portion 190c of the available filter supports 190a of filter 194 as the symmetrical partial filter, such that by truncating the filter supports 190d of the available filter supports 190a of filter 194, where the filter supports 190d of filter 194 are corresponding (e.g., have the same size and the same shape, when flipped) to the unavailable filter supports 190b of filter 194. For example, in Figure 6, each sample in 190b and 190d is replaced by the closest sample in 190c. The sample in C1 is replaced by the sample in C5, the samples in C0 and C2 are replaced by the sample in C6, and the sample in C3 is replaced by the sample in C7.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In this manner, the video encoder 200 and the video decoder 300 may generate a filter from the available filter samples, skipping the filtering of stoppers for which the corresponding samples are unavailable. The video encoder 200 and the video decoder 300 may renormalize the symmetric subfilter such that, for example, the filtering coefficients of the symmetric subfilter equal one. The video encoder 200 and the video decoder 300 may apply the generated filter, for example, to the samples in a reconstructed video data clip, such as in clip 170, to generate the candidate samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the video encoder 200 and the video decoder 300 may perform a filtering operation on the video data that includes weighted summation. In particular, weighted summation is a weighted averaging operation that is added after the filtering operation for those samples that use one or more unavailable samples (e.g., samples from an image / slide / panel / group of panels, as described throughout this disclosure) during the filtering. A final ALF output sample represents a weighted average of the filtered sample and the ALF input sample (e.g., a post-ALF sample and a pre-ALF reconstructed video data segment sample, respectively). The video encoder 200 and the video decoder 300 may apply (i.e., multiply) a first weight to a sample value of the pre-ALF reconstructed video data segment sample and may apply (i.e., multiply) a second weight to a sample value of the post-ALF sample, where the sum of the two weights equals one. The video encoder 200 and the video decoder 300 may sum the two weighted samples and divide the sum by two to determine the weighted mean of the sample.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In one example, the weight of the candidate sample may be fixed for all samples. For example, when the first weight is fixed to a first value and the second weight is fixed to a second value for all samples, where the sum of the two weights is equal to one, the video encoder 200 and the video decoder 300 may, for each sample, apply the first weight to the sample value for the sample before the ALF and apply the second weight to the sample value for the sample after the ALF, then sum the two weighted samples, and divide the sum by two to generate the final sample value.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In another example, the weight of a filtered sample might depend on the number of unavailable samples used during the filtering process. The more unavailable samples used during the filtering process, the higher the weight applied to the reconstructed video data sample before ALF compared to the weight applied to the same sample after ALF. For example, if no unavailable samples were used during the filtering process for a sample during ALF, the first weight applied to the sample before ALF might be zero, and the second weight applied to the sample after ALF might be one. Conversely, the first weight might increase depending on the number of unavailable samples used during the filtering process for the sample, and conversely, the second weight might decrease depending on the number of unavailable samples used during the filtering process.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In another example, the weight of the filtered sample may be indicated twin-wise, such as at a sequence / image / slice / plate / array of panels / CTU level. For example, encoder 200 may twin-wise transmit a signal with both the first weight and the second weight to decoder 300, such as at a sequence / image / slice / plate / array of panels / CTU level.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the video encoder 200 and the video decoder 300 may conditionally disable filtering of samples that use unavailable samples (e.g., samples from an image, slide, plate, or set of plates) for filtering. In one example, for the current sample to be filtered, if the absolute sum of the coefficients corresponding to the unavailable samples is greater than a threshold value multiplied by the absolute sum of the coefficients corresponding to the available samples, the video encoder 200 and the video decoder 300 may disable the filter for the current sample. This threshold value may be fixed, twin-determined, or indicated (e.g., in the bit stream transmitted by the video encoder 200 to the video decoder 300). Examples of the threshold value include 0.6 or may be any suitable value, such as between zero and 1.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Figure 7 is a block diagram illustrating an analog video encoder 200 that may perform the techniques of this disclosure. Figure 7 is provided for interpretive purposes and should not be considered to limit the techniques as extensively illustrated and described in this disclosure. For interpretive purposes, this disclosure describes a video encoder 200 in accordance with the JEM, VVC (ITU-T H.266, under development), and HEVC (ITU-T H.265) techniques. However, the techniques of this disclosure may be performed by video encoders configured to other video programming standards.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In the example of Figure 7, the video encoder 200 includes a video data memory 230, a mode selection unit 202, a residual generation unit 204, a conversion processing unit 206, a quantization unit 208, an inverse quantization unit 210, an inverse conversion processing unit 212, a reconstruction unit 214, a filter unit 216, a decoded picture buffer (DPB) 218, and an entropy coding unit 220. Any or all of the video data memory 230, the mode selection unit 202, the residual generation unit 204, the conversion processing unit 206, the quantization unit 208, the inverse quantization unit 210, the inverse conversion processing unit 212, the reconstruction unit 214, the filter unit 216, the DPB 218, and the entropy coding unit 220 may be implemented in one or more processors or processing circuits. For example, the video encoder modules 200 may be implemented as one or more circuits or logic elements as part of the hardware circuitry, or as part of a processor, ASIC, of ​​an FPGA. Furthermore, the video encoder 200 may include additional or alternative processors or processing circuits to perform these and other functions.<h2 style=";text-align:left;direction:ltr">In some examples, the video encoder 200 may be part of a camera, computer, mobile device, broadcast receiver, or receiver.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video data memory 230 may store video data to be encoded by components of the video encoder 200. The video encoder 200 may receive video data stored in the video data memory 230 from, for example, the video source 104 (FIG. 1). The DPB 218 may serve as a reference image memory that stores the reference video data for use in predicting subsequent video data by the video encoder 200. The video data memory 230 and the DPB 218 may be composed of any variety of memory devices, such as dynamic random-access memory (DRAM), including synchronous DRAM (SDRAM), magnetoresistive RAM (MRAM), resistive RAM (RRAM), or other types of memory devices. The video data memory 230 and the DPB 218 may be provided by the same memory device or by separate memory devices. In various examples, the video data memory 230 may be on-chip with other components of the video encoder 200, as shown, or off-chip with respect to those components.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In this disclosure, reference to video data memory 230 is not to be construed as limited to the internal memory of the video encoder 200, unless specifically described as such, or to the external memory of the video encoder 200, unless specifically described as such. Instead, reference to video data memory 230 is to be understood as a reference memory that stores video data received by the video encoder 200 for encoding (e.g., video data for a current segment to be encoded). The memory 106 according to Figure 1 may also provide temporary storage of outputs from various modules of the video encoder 200.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The various modules are illustrated in Figure 7 to help understand the operations performed by the video encoder 200. The modules may be implemented as fixed-function circuits, programmable circuits, or a combination thereof. Fixed-function circuits refer to circuits that provide specific functions and are preset for the possible operations. Programmable circuits refer to circuits that can be programmed to perform various tasks and provide flexible functionality in the possible operations. For example, programmable circuits may implement software or firmware that causes the programmable circuits to operate in the manner specified by the software or firmware instructions. Fixed-function circuits may implement software instructions (e.g., to receive variables or output variables), but the types of operations performed by fixed-function circuits are generally unchanged. In some examples, one or more modules may be distinct circuit segments (fixed-function or programmable), and in some examples, one or more modules may be integrated circuits.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 may include arithmetic logic units (ALUs), elementary function units (EFUs), digital circuits, analog circuits, and / or programmable cores, formed from the programmable circuits. In examples where the operations of the video encoder 200 are performed using a program executed by the programmable circuits, memory 106 (FIG. 1) may store instructions (e.g., object code) for the program that the video encoder 200 receives and executes, or other memory within the video encoder 200 (not shown) may store such instructions.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The video data memory 230 is configured to store the received video data. The video encoder 200 may retrieve a video data image from the video data memory 230 and provide the video data to the residual generation unit 204 and the mode selection unit 202. The video data in the video data memory 230 may be raw video data to be encoded.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The mode selection module 202 includes a motion estimation module 222, a motion compensation module 224, and an internal prediction module 226. The mode selection module 202 may include additional functional modules to perform video prediction according to other prediction modes. As examples, the mode selection module 202 may include a palette module, an in-clip copy module (which may be part of the motion estimation module 222 and / or the motion compensation module 224), an affine module, a linear model (LM) module, or the like.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The mode selection module 202 generally coordinates multiple encoding passes to test sets of encoding variables and the resulting rate distortion values ​​for such sets. The encoding variables may include partitioning CTUs into CUs, prediction modes for CUs, transformation types for the remaining data for CUs, quantization variables for the remaining data for CUs, and so on. The mode selection module 202 may ultimately select a set of encoding variables that has better rate distortion values ​​than the other tested sets.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 may partition an image retrieved from the video data memory 230 into a series of CTUs, encapsulating one or more CTUs within a chip. The mode selection unit 202 may partition the image CTU according to a tree structure, such as the QTBT structure or the HEVC quad-tree structure described above. As described above, the video encoder 200 may form CUs from the CTU partition according to the tree structure. A CU may also be generally referred to as a "video clip" or a "clip."<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In general, the mode selection module 202 also controls its components (e.g., the motion estimation module 222, the motion compensation module 224, and the interprediction module 226) to generate a prediction segment for a current segment (e.g., a current CU, or in HEVC, the interlaced portion of PU and TU). To interpredict a current segment, the motion estimation module 222 may perform a motion search to identify one or more closely matching reference segments in one or more reference images (e.g., one or more preprogrammed images stored in the DPB 218). Specifically, the motion estimation module 222 may calculate a value representative of how similar a potential reference segment is to the current segment, e.g., according to the sum of absolute differences (SAD), sum of squared differences (SSD), mean absolute differences (MAD), mean squared differences (MSD), or the like. The motion estimation unit 222 may generally perform these calculations using sample-by-sample differences between the current segment and the reference segment under consideration. The motion estimation unit 222 may select a reference segment with the lowest value resulting from these calculations, indicating a reference segment that most closely matches the current segment.<h2 style=";text-align:left;direction:ltr">The motion estimation module 222 may form one or more motion vectors (MVs) that specify the positions of reference segments in the reference images relative to the position of the current segment in a current image. The motion estimation module 222 may then provide the motion vectors to the motion compensation module 224. For example, for a unidirectional interpolation prediction, the motion estimation module 222 may provide one motion vector, while for a bidirectional interpolation prediction, the motion estimation module 222 may provide two motion vectors. The motion compensation module 224 may then generate a prediction segment using the motion vectors. For example, the motion compensation module 224 may recover data for the reference segment using the motion vector. As another example, if the motion vector has a subsample resolution, the motion compensation module 224 may interpolate the prediction segment values ​​according to one or more interpolation filters. Furthermore, for bidirectional interprediction, the motion compensation unit 224 may recover data for two reference segments identified by the respective motion vectors and combine the recovered data, for example, by sample-by-sample averaging or weighted averaging.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> As another example, for interprediction, or internal prediction programming, the interprediction module 226 may generate a prediction segment from samples adjacent to the current segment. For example, for trend modes, the interprediction module 226 may generally mathematically sum the values ​​of adjacent samples and populate these calculated values ​​in the specified direction across the current segment to produce the prediction segment. As another example, for DC mode, the interprediction module 226 may calculate the average of samples adjacent to the current segment and generate a prediction segment that includes this resulting average for each sample of the prediction segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The mode selector 202 provides the prediction segment to the residual generation module 204. The residual generation module 204 receives a raw, undecoded copy of the current segment from the video data memory 230 and the prediction segment from the mode selector 202. The residual generation module 204 calculates the sample-by-sample differences between the current segment and the prediction segment. The resulting sample-by-sample differences determine a residual segment for the current segment. In some examples, the residual generation module 204 may also determine the differences between sample values ​​in the residual segment to generate a residual segment using residual differential pulse code modulation (RDPCM). In some examples, the residual generation module 204 may be modulated using one or more subtraction circuits that perform a binary subtraction operation.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In examples where the mode selector 202 subdivides CUs into PUs, each PU may be associated with a luma prediction unit and analog chroma prediction units. The video encoder 200 and video decoder 300 may support PUs of varying sizes. As described above, the size for the CU may refer to the size of the luma programming segment of the CU, and the size for the PU may refer to the size of the luma prediction unit of the PD. Assuming the size for a particular CU is 2Nx2N, the video encoder 200 may support PU sizes of 2Nx2N or NxN for internal prediction, and analog PU sizes of 2Nx2N, 2NxN, Nx2N, NxN, or the like for internal prediction. The video encoder 200 and video decoder 300 may also support asymmetric partitioning of PU sizes of 2NxnU, 2NxnD, nLx2N, and nRx2N for internal prediction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In examples where the mode selector 202 does not divide the CU into PUs, each CU may be associated with a luma programming segment and analog chroma programming segments. As noted above, the size of the CU may refer to the luma programming segment of the CU. The video encoder 200 and video decoder 300 may support CU sizes of 2Nx2N, 2NxN, or Nx2N.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">For other video programming techniques such as in-clip mode programming, segment affinity programming, and linear model (LM) mode programming, to name a few, the mode selection module 202, via the respective modules associated with the programming techniques, generates a predictive segment for the current segment being encoded. In some examples, such as panel mode programming, the mode selection module 202 may not generate a predictive segment, but instead generates syntactic elements that indicate how the segment is to be reconstructed based on a specific panel. In such modes, the mode selection module 202 may provide these syntactic elements to the inertial encoder module 220 to be encoded.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> As described above, the residual generation unit 204 receives video data for the current segment and the analog prediction segment. The residual generation unit 204 generates a residual segment for the current segment. To generate the residual segment, the residual generation unit 204 calculates the sample-by-sample differences between the prediction segment and the current segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The transformation processing unit 206 applies one or more transformations to the residual segment to generate a segment of transformation operators (referred to herein as a "transformation operator block"). The transformation processing unit 206 may apply various transformations to the residual segment to form the transformation operator segment. For example, the transformation processing unit 206 may apply a discrete cosine transform (DCT), a vector transform, a Karhunen-Loeve transform (KLT), or a conceptually similar transformation to the residual segment. In some examples, the transformation processing unit 206 may perform multiple transformations to the residual segment, e.g., a primary transformation and a secondary transformation, such as a rotational transformation. In some examples, the transformation processing unit 206 does not apply transformations to the residual segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The quantization module 208 may quantize the conversion coefficients in the conversion coefficient segment, producing a quantization conversion coefficient segment. The quantization module 208 may quantize the conversion coefficients of the conversion coefficient segment according to the value of the quantization variable (QP) associated with the current segment. The video encoder 200 may adjust (e.g., via the mode selector 202) the degree of quantization applied to the conversion coefficient segments associated with the current segment by adjusting the QP value associated with the CU. Quantization may result in a loss of information, and therefore, the quantization conversion coefficients may have less precision than the original conversion coefficients produced by the conversion processing module 206.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The inverse quantization unit 210 and the inverse transformation processing unit 212 may apply inverse quantizations and inverse transformations to a quantization transformation operator segment, respectively, to reconstruct a residual segment from the transformation operator block. The reconstruction unit 214 may produce reconstructed segments corresponding to the residual segment (albeit possibly with some degree of distortion) based on the reconstructed residual segment and a prediction segment generated by the mode selection unit 202. For example, the reconstruction unit 214 may add samples from the reconstructed residual segment to analog samples from the prediction segment generated by the mode selection unit 202 to produce the reconstructed segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The filter unit 216 may perform one or more SAO, GALF, ALF, and / or segment removal operations on the reconstructed programming segments associated with the CU. For example, the filter unit 216 may perform segment removal operations to reduce segment artifacts along the edges of the CUs. The filter unit 216 operations may, in some examples, be skipped.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Specifically, the filter module 216 may be configured to perform the ALF and GALF techniques of this disclosure described above. For example, the filter module 216 may be configured to determine the gradient value of a sample in a reconstructed programming segment, including performing gradient computation for the sample using an unavailable sample located outside one of: an image, a slice, a panel, or a set of panels comprising the reconstructed sample segments, determining a twin-loop filter for the reconstructed programming segment based at least in part on the specified gradient value of the sample, and applying the specified twin-loop filter to the reconstructed programming segment to generate a filtered video data segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the filter module 216 may be configured to determine gradient values ​​for a window covering the reconstructed programming segment, the window including samples of the reconstructed video data segment and samples surrounding the reconstructed video data segment; and to perform a gradient calculation using an unavailable sample, for example, in accordance with the techniques of the present disclosure, and to determine a twin-ring filter for the reconstructed programming segment based at least in part on the gradient values ​​determined for the window. This may include, for example, replacing the unavailable gradient values ​​of samples within the window that fall outside the boundary of one of an image, slice, panel, or plurality of panels with one or more gradient values ​​within the boundary, where one of the image, slice, panel, or plurality of panels includes the reconstructed programming segment, for example, in accordance with the techniques of the present disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the filter module 216 may be configured to refrain from including gradient values ​​that are not available for in-window samples that fall outside a boundary of an image, slice, or set of panels in the window gradient values, where the image, slice, slice, or set of panels includes the reconstructed video data segment. The filter module 216 may normalize the window gradient values ​​by not including gradient values ​​that are not available for in-window samples in the window gradient values.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the filter unit 216 may, in response to a twin-ring filter using filter supports corresponding to unavailable samples, be configured to select a subfilter from the twin-ring filter that does not use filter supports corresponding to unavailable samples, wherein the subfilter comprises one of: an asymmetric subfilter or a symmetric subfilter. In other examples, the filter unit 216 may, in response to a twin-ring filter using filter supports corresponding to unavailable samples, be configured to fill the mirror to replace the filter supports corresponding to unavailable samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the filtering module 216 may be conditionally configured to disable filtering of a particular sample of the reconstructed programming clip based at least in part on at least one of: whether determining one or more gradient values ​​for the particular sample involves performing one or more gradient calculations for the particular sample using one or more unavailable samples, or whether determining gradient values ​​for the window covering the reconstructed video data clip involves determining one or more gradient values ​​for one or more samples within the window that fall outside the boundary of one of:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The image, slide, panel, or group of panels, where the reconstructed video data segment is within the boundary.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the filter module 216 may be configured to determine a weighted average on the reconstructed video data segment and for the candidate video data segment sample based at least in part on at least one of: whether determining one or more gradient values ​​for the given sample includes performing one or more gradient calculations for the given sample using one or more unavailable samples, or whether determining gradient values ​​for the window covering the reconstructed video data segment includes determining one or more gradient values ​​for one or more samples within the window that fall outside a boundary of an image, slice, panel, or set of panels, within which the reconstructed video data segment falls.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 stores the reconstructed segments in DPB 218. For example, in examples that do not require filter unit 216 operations, the reconstruction unit 214 may store the reconstructed segments in DPB 218. In examples that require filter unit 216 operations, the filter unit 216 may store the candidate reconstructed segments in DPB 218. The motion estimation unit 222 and the motion compensation unit 224 may retrieve a reference image from DPB 218, formed from the reconstructed (and potentially candidate) segments, to internally predict segments for subsequent encoding images. In addition, the internal prediction unit 226 may use the reconstructed segments in DPB 218 for a current image for other internal prediction segments in the current image.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In general, the entropy coding unit 220 may encode syntax elements received from other functional components of the video encoder 200. For example, the entropy coding unit 220 may encode quantization coefficient segments from the quantization unit 208. As another example, the entropy coding unit 220 may encode prediction syntax elements (e.g., motion information for an interprediction or intra-mode information for an intraprediction) from the mode selection unit 202. The entropy coding unit 220 may perform one or more entropy coding operations on the syntax elements, which are another example of video data, to generate entropy coding data. For example, the entropy coding unit 220 may perform a context-aware variable-length programming (CAVLC) operation, a CABAC operation, a variable-to-variable-length programming (V2V) operation, a syntax-based context-aware binary arithmetic programming (SBAC) operation, a time-division-interval entropy programming (PIPE) operation, a Golomb exponential encoding operation, or another type of entropy coding operation on the data.<h2 style=";text-align:left;direction:ltr">In some examples, the thermal inertia encoder 220 may operate in bypass mode where the syntax elements are not thermal inertia encoders.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The video encoder 200 may output a bit stream that includes the entropic coding syntax elements necessary to reconstruct segments of a slide or image. Specifically, the entropic coding module 220 may output the bit stream.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The operations described above are described in relation to a segment. This description should be understood as operations for the Luma programming segment and / or the Chroma programming segments. As described above, in some examples, the Luma programming segment and the Chroma programming segments are Luma and Chroma components of the CU. In some examples, the Luma programming segment and the Chroma programming segments are Luma and Chroma components of the PU.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the operations performed for a luma programming segment need not be repeated for the chroma programming segments. As one example, the operations for determining a motion vector (MV) and a reference image for a luma programming segment need not be repeated to determine the MV and reference image for the chroma segments. Alternatively, the MV for the luma programming segment may be scaled to determine the MV for the chroma segments, and the reference image may be the same. As another example, the interprediction process may be the same for the luma programming segment and the chroma programming segments.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 is an example of a device adapted for encoding video data that includes a memory adapted for storing video data, one or more processing units implemented in circuitry and adapted for a reconstructed video data segment to generate a reconstructed video data segment, determining a gradient value for a sample in the reconstructed video data segment, comprising performing a gradient calculation for the sample using an unavailable sample located outside one of: an image, a slice, a plate, or a plurality of plates comprising the reconstructed sample segments, determining a twin-loop filter for the reconstructed video data segment based at least in part on the specified gradient value of the sample, and applying the specified twin-loop filter to the reconstructed video data segment to generate a filtered video data segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Figure 8 is a step-by-step diagram illustrating an example of a video decoder 300 that may perform the techniques of this disclosure. Figure 8 is provided for illustrative purposes and is not limited to the techniques as broadly described and described in this disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In the example of Fig. 4, the video decoder 300 includes a programmable picture buffer 320 (CPB), a thermal decoder 302, a prediction processing unit 304, an inverse quantizer 306, an inverse transform processing unit 308, a reconstruction unit 310, a filter unit 312, and a picture buffer 314 (DPB). Any or all of the CPB 320, thermal decoder 302, prediction processing unit 304, an inverse quantizer 306, an inverse transform processing unit 308, a reconstruction unit 310, a filter unit 312, and a DPB 314 may be implemented in one or more processors or processing circuits. For example, the video decoder 300 modules may be implemented as one or more circuits or logic elements as part of a hardware circuit, or as part of a processor, ASIC, for an FPGA. Furthermore, the video decoder 300 may include additional or alternative processors or processing circuits to perform these and other functions. In some examples, the video decoder 300 may be part of a camera, computer, mobile device, broadcast receiver, or set-top box.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The prediction processing unit 304 includes a motion compensation unit 316 and an internal prediction unit 318. The prediction processing unit 304 may include additional units for performing prediction according to other prediction modes. As examples, the prediction processing unit 304 may include a planar unit, an intra-segment copy unit (which may form part of the motion compensation unit 316), a combination unit, a linear model (LM) unit, or the like. In other examples, the video decoder 300 may include more, fewer, or different functional components.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The CPB memory 320 may store video data, such as a video encoding bitstream, to be decoded by components of the video decoder 300. The video data stored in the CPB memory 320 may be obtained, for example, from a computer-readable medium 110 (FIG. 1). The CPB memory 320 may include a CPB that stores the encoding of video data (e.g., syntax elements) from the video encoding bitstream. Also, the CPB memory 320 may store video data other than the syntax elements of a programmed image, such as temporary data representing outputs from various modules of the video decoder 300. The DPB 314 generally stores the decoding images, which the video decoder 300 may output and / or use as reference video data when decoding subsequent data or images of the video encoding bitstream. The CPB 320 and DPB 314 memory can be configured with any variety of memory devices, such as DRAM, which includes SDRAM, MRAM, RRAM, or other types of memory devices. The CPB 320 and DPB 314 memory can be provided by the same memory device or by separate memory devices.<h2 style=";text-align:left;direction:ltr">In various examples, the CPB memory 320 may be on-chip with other components of the video decoder 300, or off-chip with respect to those components.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Additionally or alternatively, in some examples, the video decoder 300 may retrieve programmed video data from memory 120 (FIG. 1). That is, memory 120 may store data as described above with the CPB memory 320. Similarly, memory 120 may store instructions to be executed by the video decoder 300, when some or all of the functions of the video decoder 300 are implemented in a program to be executed by the processing circuitry of the video decoder 300.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The various modules shown in Figure 8 are illustrated to help understand the operations performed by the video decoder 300. The modules can be implemented as fixed-function circuits, programmable circuits, or a combination thereof. Similar to Figure 7, fixed-function circuits refer to circuits that provide specific functions and are preset to the operations they can perform. Programmable circuits refer to circuits that can be programmed to perform various tasks and provide flexibility in the operations they can perform.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">For example, programmable circuits may implement software or firmware that causes the programmable circuits to operate in the manner specified by the software or firmware instructions. Fixed-function circuits may implement software instructions (for example, to receive variables or output variables), but the types of operations that fixed-function circuits perform are generally unchangeable. In some examples, one or more modules may be distinct circuit segments (fixed-function or programmable), and in some examples, one or more modules may be integrated circuits.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The video decoder 300 may include ALUs, EFUs, digital circuitry, analog circuitry, and / or a programmable core formed from programmable circuitry. In examples where operations of the video decoder 300 are performed by software executed on the programmable circuitry, on-chip or off-chip memory may store instructions (e.g., object code) for the software that the video decoder 300 receives and executes.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The thermal inertial decoder 302 may receive encoded video data from the CPB and thermal inertial decoder 302 to reproduce syntax elements. The prediction processing unit 304, inverse quantization unit 306, inverse transform processing unit 308, reconstruction unit 310, and filter unit 312 may generate decoded video data based on syntax elements extracted from the bit stream.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In general, the video decoder 300 reconstructs an image on a clip-by-clip basis. The video decoder 300 can perform a clip-by-clip reconstruction (where the clip currently being reconstructed, i.e., decoded, may be referred to as the "current clip").<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The thermal inertia decoder 302 may thermally decode syntax elements that specify the quantized conversion coefficients of the quantized conversion coefficient segment, as well as conversion information, such as the quantizer (QP) and / or conversion mode indicator(s). The inverted quantity module 306 may use the QP associated with the quantized conversion coefficient segment to specify the degree of the quantizations and, likewise, the degree of the inverted quantities of the inverted quantity module 306 for its application. The inverted quantity module 306 may, for example, perform a bitwise left-shift operation to quantize the quantized conversion coefficients. The inverted quantity module 306 may thus constitute a conversion coefficient segment comprising the conversion coefficients.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> After the inverse quantity unit 306 forms the transformation operator segment, the inverse transformation processing unit 308 may apply one or more inverse transformations to the transformation operator segment to generate a residual segment associated with the current segment. For example, the inverse transformation processing unit 308 may apply an inverse DCT, inverse integer transformation, inverse Karhunen-Loeve transform (KLT), inverse rotational transformation, inverse directional transformation, or other inverse transformation to the transformation operator segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Furthermore, the prediction processing unit 304 generates a prediction segment based on the prediction information syntax elements decoded by the thermal inertia decoder 302. For example, if the prediction information syntax elements indicate that the current segment is an interprediction, the motion compensation unit 316 may generate the prediction segment. In this case, the prediction information syntax elements may indicate a reference image in the DPB 314 from which a reference segment may be recovered, as well as a motion vector that specifies the location of the reference segment in the reference image relative to the location of the current segment in the current image. The motion compensation unit 316 may generally perform the interprediction process in a manner substantially similar to that described with respect to the motion compensation unit 224 (FIG. 7).<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">As another example, if the elements of the prediction information syntax indicate that the current segment is an internal prediction, the internal prediction module 318 may generate the prediction segment according to the internal prediction mode indicated by the prediction information syntax elements. Again, the internal prediction module 318 may generally perform the internal prediction process in a manner substantially similar to that described with respect to the internal prediction module 226 (FIG. 7). The internal prediction module 318 may retrieve data from the DPB 314 for the current segment's adjacent sample data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The reconstruction unit 310 may reconstruct the current segment using the prediction segment and the remaining segment. For example, the reconstruction unit 310 may add samples from the remaining segment to corresponding samples of the prediction segment to reconstruct the current segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The filter module 312 may perform one or more filter operations on the reconstructed clips. For example, the filter module 312 may perform clip removal operations to reduce clip artifacts along the edges of the reconstructed clip. The filter module 312 operations are not necessarily performed in all examples. Specifically, the filter module 312 may be configured to perform the ALF and GALF techniques of this disclosure described above. For example, the filter module 312 may be configured to determine a gradient value for a sample in a reconstructed programming clip, which includes performing a gradient calculation for the sample using an unavailable sample located outside one of: an image, a slice, a panel, or a group of panels comprising the reconstructed sample clips; determining a twin-loop filter for the reconstructed programming clip based at least in part on the specified gradient value of the sample; and applying the specified twin-loop filter to the reconstructed programming clip to generate a filtered video data clip.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the filter module 312 may be configured to determine gradient values ​​for a window covering the reconstructed programming segment, the window including samples of the reconstructed video data segment and samples surrounding the reconstructed video data segment, comprising performing a gradient calculation using an unavailable sample, for example, in accordance with the techniques of the present disclosure, and to determine a twin-loop filter for the reconstructed programming segment based at least in part on the gradient values ​​determined for the window. This may include, for example, replacing unavailable gradient values ​​for samples within the window that fall outside the boundary of one of an image, slice, panel, or plurality of panels with one or more gradient values ​​within the boundary, where one of the image, slice, panel, or plurality of panels includes the reconstructed programming segment, in accordance with the techniques of the present disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the filter module 312 may be configured to refrain from including gradient values ​​that are not available for in-window samples that fall outside the boundary of an image, slice, palette, or set of palettes in the gradient values ​​of the window, wherein the image, slice, palette, or set of palettes includes the reconstructed video data segment. The filter module 216 may normalize the gradient values ​​of the window by not including gradient values ​​that are not available for in-window samples in the gradient values ​​of the window.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the filter module 312 may be configured, in response to a twin-ring filter that uses filter supports corresponding to unavailable samples, to select a subfilter from the twin-ring filter that does not use filter supports corresponding to unavailable samples, wherein the subfilter includes one of: an asymmetric subfilter or a symmetric subfilter. In other examples, the filter module 216 may be configured, in response to a twin-ring filter that uses filter supports corresponding to unavailable samples, to perform a mirror-filling procedure to replace the filter supports corresponding to unavailable samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the filter module 312 may be conditionally configured to disable filtering of a particular sample of the reconstructed programming segment based at least in part on at least one of: if determining one or more gradient values ​​for the particular sample involves performing one or more calculations for the particular sample using one or more unavailable samples; if determining gradient values ​​for the window covering the reconstructed video data segment involves determining one or more gradient values ​​for one or more samples within the window that fall outside a boundary of an image, slice, panel, or group of panels, within which the reconstructed video data segment falls.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the filter module 312 may be configured to determine a weighted average on the reconstructed video data segment and for the candidate video data segment sample based at least in part on at least one of: whether determining one or more gradient values ​​for the given sample includes performing one or more gradient calculations for the given sample using one or more unavailable samples, or whether determining gradient values ​​for the window covering the reconstructed video data segment includes determining one or more gradient values ​​for one or more samples within the window that fall outside a boundary of an image, slice, panel, or set of panels, within which the reconstructed video data segment falls.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video decoder 300 may store the reconstructed segments in the DPB 314. For example, in examples where the filter module 312 operations are not performed, the reconstruction module 310 may store the reconstructed segments in the DPB 314. In examples where the filter module 312 operations are performed, the filter module 312 may store the candidate reconstructed segments in the DPB 314. As discussed above, the DPB 314 may provide reference information, such as samples of a current image for internal prediction and pre-decoded images for subsequent motion compensation, to the prediction processing module 304. Furthermore, the video decoder 300 may output decoded images (e.g., decoded video) from the DPB 314 for subsequent presentation on a display device, such as the display device 118 of FIG. 1.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In this way, the video decoder 300 represents an example of a video decoder including a memory configured to store video data, one or more processing units implemented in circuitry and configured to reconstruct a video data segment to generate a reconstructed video data segment, determining a gradient value for a sample in the reconstructed video data segment, comprising calculating a gradient for the sample using an unavailable sample located outside one of: an image, a slice, a plate, or a set of plates that includes the reconstructed clip samples, determining a twin-loop filter for the reconstructed video data segment based at least in part on the specified gradient value for the sample, and applying the specified twin-loop filter to the reconstructed video data segment to generate a filtered video data segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Figure 9 illustrates an example implementation of a filter module for performing these detection techniques. Filter modules 216 and 312 may perform these detection techniques, perhaps in conjunction with other components of the video encoder 200 or video decoder 300. In the example of Figure 9, filter module 216 and filter module 312 include a clip removal filter, a SAO filter 344, and an ALF / GLAF filter 346. The SAO filter 344 may be configured, for example, to determine offset values ​​for samples of a clip.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Filter module 216 and filter module 312 may include fewer filters and / or additional filters. In addition, the specific filters shown in Figure 9 may be implemented in a different order. Other loop filters may also be used (either in the programming loop or after the programming loop) to smooth sample transitions or improve video quality.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The segment removal filter 342 may be configured to perform segment removal filtering on a segmented reconstructed video data segment. The SAO filter 344 may be configured to perform SAO filtering on the segmented reconstructed video data segment that is output by the segment removal filter 342. The ALF / GLAF filter 346 may be configured to perform ALF or GALF on the segmented SAO filtered reconstructed video data segment that is output by the SAO filter 344.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In particular, the ALF / GALF filter 346 may be configured to determine a gradient value for a sample in the SAO-filtered de-sampled and reconstructed video data segment, including calculating the gradient for the sample using an unavailable sample that is outside one of the following: an image, a slice, a panel, or a set of panels that includes the reconstructed segment of the samples, determining a twin-ring filter for the SAO-filtered de-sampled and reconstructed segment of the video data to generate a filtered segment from the video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the ALG / GALF filter 346 may be configured to determine gradient values ​​for a window covering the de-sampled reconstructed video data segment filtered by SAO, the window including samples of the reconstructed video data segment and samples surrounding the reconstructed video data segment, which includes performing a gradient calculation using an unavailable sample, for example, in accordance with the techniques of the present disclosure, and to determine a twin-ring filter for the de-sampled reconstructed video data segment filtered by SAO based at least in part on the gradient value specified for the window. Which may include, for example, replacing the unavailable gradient values ​​of samples within the window that fall outside the boundary of one of the following: an image, a slice, a panel, or a plurality of panels with one or more gradient values ​​that are within the boundary, wherein one of the: an image, a slice, a panel, or a plurality of panels includes the de-sampled reconstructed video data segment filtered by SAO, for example, in accordance with the techniques of the present disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the ALG / GALF filter 346 may be configured to refrain from including gradient values ​​that are not available for in-window samples that fall outside the boundary of one of the image, slice, palette, or set of palettes in the window gradient values, where one of the image, slice, palette, or set of palettes includes the reconstructed video data segment. The ALG / GALF filter 346 may normalize the window gradient values ​​by not including gradient values ​​that are not available for in-window samples in the window gradient values.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the ALG / GALF filter 346 may be configured to, in response to a twin-ring filter that uses filter supports corresponding to unavailable samples, select a subfilter from the twin-ring filter that does not use filter supports corresponding to unavailable samples, wherein the subfilter includes one of: an asymmetric subfilter or a symmetric subfilter. In other examples, the ALG / GALF filter 346 may be configured to, in response to a twin-ring filter that uses filter supports corresponding to unavailable samples, perform mirror stuffing to replace the filter supports corresponding to unavailable samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the ALG / GALF filter 346 may be configured to conditionally disable the filtering of a particular sample for the de-sampled, SAO-filtered reconstructed video data segment based at least in part on at least one of: whether determining one or more gradient values ​​for the particular sample involves performing one or more gradient calculations for the particular sample using one or more unavailable samples, or whether determining gradient values ​​for the window covering the reconstructed video data segment involves determining one or more gradient values ​​for one or more samples within the window that fall outside a boundary of an image, slice, panel, or group of panels within which the reconstructed video data segment falls.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the ALG / GALF filter 346 may be configured to determine a weighted average for a given sample in the reconstructed clip and for the candidate video data clip sample based at least in part on at least one of: whether determining one or more gradient values ​​for the given sample includes performing one or more gradient calculations for the given sample using one or more unavailable samples, or whether determining gradient values ​​for a window covering the reconstructed video data clip includes determining one or more gradient values ​​for one or more samples within the window that fall outside a boundary of an image, slice, panel, or group of panels, within which the reconstructed video data clip falls.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The decoded video clips are then stored in a particular frame or image in the DPB 314, which stores the reference images used for subsequent motion compensation. The DPB 314 may be part of or separate from additional memory that stores the decoded video for later display on a display device, such as the display device 118 of Figure 1.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Figure 10 is a sequence diagram illustrating an example method for decoding a current video data segment. The current segment may include a current CU. Although described in relation to the video decoder 300 (Figures 1 and 8), it should be understood that other devices may be configured to perform a method similar to that of Figure 10.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video decoder 300 may receive entropically encoded data for the current segment, such as entropically encoded prediction information and entropically encoded data for the coefficients of the remaining segment corresponding to the current segment (370). The video decoder 300 may entropically decode the entropically encoded data to determine the prediction information for the current segment and to reproduce the coefficients of the remaining segment (372). The video decoder 300 may predict the current segment (374), for example, using an internal or interpretation mode as indicated by the prediction information for the current segment, to calculate the prediction segment for the current segment. The video decoder 300 may then inversely scan the reproduced coefficients (376) to generate a segment of the quantized transformation coefficients. The video decoder 300 may then inversely quantize and inversely transform the transformation coefficients to produce the remaining segment (378). The video decoder 300 may finally decode the current segment by combining the prediction segment and the remaining segment (380).<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the video decoder 300 may perform filtering on the decoded clip, such as declustering filtering, SAO filtering, and ALF filtering. For example, as part of the ALF filtering procedure, the video decoder 300 may determine the gradient value of a sample in a reconstructed programming clip, which includes calculating the gradient of the sample using an available sample that corresponds to an unavailable sample located outside one of: an image, a slide, a panel, or a group of panels that comprises the reconstructed sample clip; determining a twin-loop filter for the reconstructed programming clip based at least in part on the determined gradient value of the sample; and applying the determined twin-loop filter to the reconstructed programming clip to generate a filtered clip from the video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, as part of the ALF filtering procedure, the video decoder 300 may determine gradient values ​​for a window covering the reconstructed programming segment, the window including samples of the reconstructed video data segment and samples surrounding the reconstructed video data segment, including performing a gradient calculation using the unavailable sample, for example, in accordance with automated detection techniques, and determining a twin-ring filter for the reconstructed programming segment based at least in part on the gradient values ​​determined for the window. This may include, for example, substituting unavailable gradient values ​​for samples within the window that fall outside the boundary of one of an image, slice, panel, or plurality of panels, where one or more gradient values ​​fall inside the boundary, where one of the image, slice, panel, or plurality of panels includes the reconstructed programming segment, for example, in accordance with techniques of the present disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Figure 11 is a sequence diagram illustrating an example method for programming video data. The method may be performed by a video encoder 200 (Figures 1 and 7) and / or a video decoder 300 (Figures 1 and 8). Although described in relation to the video encoder 200 and decoder 300, it should be understood that other devices may be configured to perform a method similar to that of Figure 11. In some examples, the techniques of Figure 11 may be performed by a filter module 216 according to Figure 7 and / or a filter module 312 of Figure 8.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In other examples, the techniques of Figure 11 may be performed by one or more other structural units of the video encoder 200 and / or video decoder 300.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In the example of Figure 11, the video encoder 200 and / or the video decoder 300 can reconstruct a segment of the video data to create a reconstructed segment 170 of the video data (400). For example,<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The video encoder 200 and / or video decoder 300 may perform SAO decompilation or filtering to the reconstructed video data segment before performing ALF on the reconstructed video data segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 and / or video decoder 300 may determine a sample gradient value in the reconstructed video data segment 170, comprising calculating a sample gradient using an available sample that corresponds to an unavailable sample that falls outside one of: an image, slice, panel, or group of panels that comprises the reconstructed sample data segment 170 (402).<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the video encoder 200 and / or video decoder 300 may perform the gradient calculation for the sample using an available adjacent sample along a gradient direction of the gradient of the sample replacing the unavailable sample.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the video encoder 200 and / or video decoder 300 may perform mirror stuffing to identify an available adjacent sample that corresponds to the unavailable adjacent sample and may perform gradient computation for the sample using the available adjacent sample.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the video encoder 200 and / or the video decoder 300 may determine gradient values ​​for a window 172 that covers the reconstructed video data segment 170, the window including samples of the reconstructed video data segment 170 and samples surrounding the reconstructed video data segment 170.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The video encoder 200 and / or video decoder 300 may select a twin-ring filter for the reconstructed video data segment 170 based at least in part on the specified value of the gradient (404).<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the video encoder 200 and / or video decoder 300 may determine a twin ring filter for the reconstructed video data segment 170 based at least in part on the gradient values ​​selected for the window.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the video encoder 200 and / or the video decoder 300 may replace the unavailable gradient values ​​of the samples within the window 172 that fall outside the boundary of one of the: image, slice, plate, or set of plates with one or more gradient values ​​that fall inside the boundary, wherein one or more of the: image, slice, plate, or set of plates comprises the reconstructed video data segment 170.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the border includes a horizontal border 174, the video encoder 200 and / or the video decoder 300 may determine a gradient value for the sample within the window 172 and outside the horizontal border 174 as a gradient value closest to the sample within the horizontal border 174 that is on the same column as the sample within the window 172 and outside the horizontal border 174.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the boundary includes a vertical boundary 176, and the video encoder 200 and / or video decoder 300 may determine a gradient value for a sample within the window 172 and outside the vertical boundary 176 as the closest gradient value for a sample within the vertical boundary 176 that is on the same row as the sample within the window 172 and outside the vertical boundary 176.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the video encoder 200 and / or the video decoder 300 may determine a gradient value for a sample within the window 172 and outside the vertical boundary 176 as the closest diagonal gradient value for the sample within the boundary that is in the same direction as the gradient value for the diagonal gradient value for the sample within the window 172 and outside the boundary.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the video encoder 200 and / or video decoder 300 may determine additional gradient values ​​for additional samples within the reconstructed video data segment 170 to replace gradient values ​​that are not available for samples within the window 172 that are outside the boundary.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the video encoder 200 and / or the video decoder 300 may refrain from including the gradient values ​​of the unavailable samples within window 172 that fall outside the boundary of one of the image, slice, palette, or set of palettes in the gradient values ​​of window 172, where one of the image, slice, palette, or set of palettes includes the reconstructed video data segment 170, and may normalize the gradient values ​​of window 172.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The video encoder 200 and / or video decoder 300 may apply the specified twin-ring filter to the reconstructed video data segment 170 to generate a filtered segment of video data (406).<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the video encoder 200 and / or the video decoder 300, in response to a twin-loop filter that uses filter supports corresponding to unavailable samples, may select a subfilter from the twin-loop filter that does not use filter supports corresponding to unavailable samples, wherein the subfilter includes one of: an asymmetric subfilter or a symmetric subfilter.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the video encoder 200 and / or video decoder 300, in response to a twin-ring filter that uses filter supports corresponding to unavailable samples, may perform mirror stuffing to replace the filter supports corresponding to the unavailable samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the video encoder 200 and / or the video decoder 300 may conditionally disable sample filtering for the reconstructed video data segment 170 based in part on at least one of: whether determining the gradient values ​​for the sample involves performing a gradient calculation using an unavailable sample or whether determining the gradient values ​​for the window 172 covering the reconstructed video data segment 170 involves determining one or more gradient values ​​for one or more samples within the window 172 that fall outside a boundary of an image, slide, panel, or group of panels, where the reconstructed video data segment 170 falls within the boundary.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the video encoder 200 and / or the video decoder 300 may determine a weighted average for a sample in the reconstructed segment and for a sample of the candidate video data segment based at least in part on at least one of: whether determining the gradient values ​​for the sample includes performing a gradient calculation using an unavailable sample or whether determining the gradient values ​​for the window 172 covering the reconstructed video data segment 170 includes determining one or more gradient values ​​for one or more samples within the window 172 that fall outside a boundary of an image, slide, panel, or group of panels, where the reconstructed video data segment 170 falls within the boundary.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> In some examples, the video encoder 200 encodes the video data and may store the filtered video data segment in the de-assembled image buffer 218. In some examples, the video encoder 200 may capture an image that includes the video data segment with a camera.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In some examples, the video decoder 300 can decode the video data and can store the filtered video data segment in the debundled image buffer 314. In some examples, the video decoder 300 can display an image that includes the filtered video data segment.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Illustrative examples of detection include:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 1: A method for decoding video data, the method includes:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Obtain a sample segment; define a gradient for a current sample segment; and depending on the specified gradient, define a filter for the sample.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 2: The method according to Example 1, wherein determining the gradient for the current sample comprises performing a gradient calculation using an unavailable sample.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 3: The method according to Example 1, wherein the unavailable sample includes a sample outside the boundary of one or more images, slides, panels, or groups of panels that include a section of the samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 4: The method according to Examples 2 or 3, further comprising: determining a value for the unavailable sample based on a value for an available sample in a cross-section of samples.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Example 5: The method according to Example 4, wherein determining the value for the unavailable sample based on the value of the available sample in a segment of samples comprises: determining the available sample to be used in the gradient direction of the current sample.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 6: The method according to Example 5, where the direction includes a 45-degree direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 7: The method according to Example 5, where the direction includes a bearing of 135 degrees.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 8: The method according to Example 5, where the direction includes a 90-degree direction.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 9: The method according to Example 5, where the direction includes a bearing of 0 degrees.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 10: The method according to any of Examples 1-9, wherein the sample is adjacent to a vertical border of an image, slide, plate, or group of plates.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 11: The method according to any of Examples 1-9, wherein the sample is adjacent to a horizontal border of an image, slide, plate, or group of plates.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 12: The method according to any of Examples 1-11, wherein the sample is a sample of a subsection and determining the gradient of the sample includes determining the gradient of the subsection.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 13: The method according to Example 12, where the subsection includes a 4×4 section.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Example 14: The method according to any of Examples 1-13, where the sample includes a Lumma sample.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 15: The method according to any of Examples 1-14, further comprising: depending on the specified gradient, selecting a filter for the current sample; in response to the selected filter using filter supports corresponding to unavailable samples, filtering the current sample using a partial filter.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 16: The method according to Example 15, wherein the subfilter includes an analog subfilter.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 17: The method according to Example 15, wherein the subfilter includes an asymmetric subfilter.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 18: The method according to any of Examples 1-17 further comprises: filtering the sample using the specified filter.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 19: The method according to any of Examples 1-15, wherein the decoding method is performed as part of a video encoding process.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 20: A video data decoding device, the device comprising: memory configured to store video data; and one or more processors configured to decode video data using any technology described in Examples 1-8 and / or any technology described in this disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Example 21: The apparatus according to Example 20, wherein the apparatus includes a wireless communication device, further including a receiver configured to receive encoded video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 22: The apparatus according to Example 21, wherein the wireless communication apparatus includes a telephone handset and wherein the receiver is configured to demodulate a signal comprising video data encoded in accordance with a wireless communication standard.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 23: A computer-readable storage medium that stores instructions that when executed by one or more processors cause one or more processors to decode video data using any technology described in Examples 1-19 and / or any technology described in this disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 24: A video data decoder, the device comprising a means for decoding the video data using any technology described in Examples 1-19, and / or a means for decoding the video data using any technology described in this disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">Example 25: A device for encoding video data, the device comprising: a memory configured to store video data; and one or more processors configured to encode video data using any technology described in Examples 1-19 and / or any technology described in this disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 26: The apparatus according to Example 25, wherein the apparatus includes a wireless communication device, further including a transmitter configured to transmit encoded video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 27: The apparatus according to Example 26, wherein the wireless communication apparatus includes a telephone handset and wherein the transmitter is configured to modulate, in accordance with a wireless communication standard, a signal comprising encoded video data.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 28: A computer-readable storage medium that stores instructions that when executed by one or more processors cause one or more processors to encode video data using any technology described in Examples 1-19 and / or any technology described in this disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Example 29: A device for decoding video data, the device comprising:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">A means of encoding video data using any technology described in Examples 1-19; and / or a means of encoding video data using any technology described in Examples 1-19; and / or a means of encoding video data using any technology described in this disclosure.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Certain aspects of this disclosure relating to HEVC, HEVC extensions, and the development of the VVC standard are described for illustrative purposes. However, the techniques described in this disclosure may be useful for other video programming processes, including other standard or proprietary video FVL[M] processes that encode processes not yet developed.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Video programmer, as described in this disclosure, may refer to a video encoder or a video decoder. Similarly, a video programming unit may refer to a video encoder or a video decoder. Similarly, video programming may refer to a video encoder or a video decoder, as applicable.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In this disclosure, the term "in reliance on" may mean relying solely on, relying at least partially on, or relying in some way on. This disclosure may use the term "video module," "video clip," or "clip" to refer to one or more sample clips and<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Syntax structures used to program one or more sample segments. Examples of video unit types might include CTUs, CUs, Pus, TUs, macrosegments, macrosegments, and so on. In some contexts, the discussion of Pus may be interchanged with the discussion of macrosegments or macrosegments. Examples of video segment types might include programming tree segments, programming segments, and other types of video data segments.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The techniques of this disclosure can be applied to video programming to support any variety of multimedia applications, such as over-the-air television broadcasting, cable television broadcasting, satellite television broadcasting, Internet video broadcasts, such as Dynamic Twin Streaming over HTTP (DASH), digital video being encoded onto a data storage medium, decoding of digital video stored on a data storage medium, or other applications.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> It should be recognized that, depending on the example, any actions or events of any of the techniques described here could be performed in a different sequence—they could be added, combined, or excluded altogether (i.e., not all of the actions or events described are necessary to practice the techniques). Furthermore, in certain examples, the actions or events could be performed simultaneously, e.g., through multi-stage processing, stop processing, or multiple processing, rather than sequentially.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">In one or more examples, the described functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted via one or more instructions or code on a computer-readable medium and executed by a hardware-based processing unit. The computer-readable media may include computer-readable storage media, or communications media, including any medium that facilitates the transmission of a computer program from one location to another, for example, according to a communications protocol. In this way, computer-readable media may generally correspond to (1) tangible computer-readable storage media that is non-volatile or (2) a communications medium such as a signal or carrier wave. The data storage media may be any available media that is accessible by one or more computers or one or more processors to retrieve instructions, code, and / or data structures for implementing the techniques described in this disclosure. The computer software product may include a computer-readable medium.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">By way of example, but not limited to, such computer-readable storage media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage, other magnetic storage devices, flash memory, or any other medium that can be used to store the required program code in the form of instructions or data structures that can be accessed by a computer. Also, any communication is properly called a computer-readable medium. For example, if instructions are transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. It should be understood, however, that computer-readable storage media and data storage media do not involve communications, carrier waves, signals, or other ephemeral media, but instead are directed to tangible, non-evident storage media.<h2 style=";text-align:left;direction:ltr">Disc and record, as used herein, include compact disc (CD), laserdisc, optical disc, digital versatile disc (DVD), floppy disc, and Blu-ray Disc, where discs typically reproduce data magnetically, while records reproduce data optically by means of a laser beam. Combinations of the above shall also be included within the scope of computer-readable media.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">The functional performance described in this disclosure may be implemented by a fixed function and / or programmable processing circuit. For example, the instructions may be executed by one or more processors, such as one or more digital signal processors (DSPs), general-purpose microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or equivalent integrated or discrete logic circuits. Accordingly, the terms "processor" and "processing circuit" as used herein may refer to any of the foregoing architectures or any other architecture suitable for implementing the technologies described herein. In addition, in some aspects, the functional performance described herein may be provided within dedicated hardware and / or software modules configured for encoding and decoding, or incorporated into embedded programming software. Also, the technologies may be implemented entirely in one or more circuits or logic elements. Also, the technologies may be implemented entirely in one or more circuits or logic elements. The processing circuits may be coupled with other components in various ways.<h2 style=";text-align:left;direction:ltr">For example, the processing circuit can be paired with other components via an internal device connection, a wired or wireless network connection.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> The techniques of this disclosure can be implemented in a variety of instruments and devices, including a wireless headset, an integrated circuit (IC), or a set of ICs (e.g., a chipset). The various components, modules, or units described in this disclosure are described to demonstrate the functional aspects of instruments configured to perform the disclosed techniques, but do not necessarily require demonstration by different hardware modules. Instead, as described above, the various modules may be combined into a programmable software module or provided by interoperable hardware modules, including one or more processors as described above, in conjunction with appropriate software and / or firmware.<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr"> Numerous examples have been described. These and other examples fall within the scope of the following safeguards.