Context-aware quantization for high-performance video encoding
Disclosed are apparatuses, systems, and techniques for efficient real-time codec encoding of video files. In one embodiment, the techniques include generating a block of predicted pixels that approximates a block of source pixels of an image frame and representing a difference between the block of source pixels and the block of predicted pixels via a plurality of transformation coefficients (TCs). The techniques further include evaluating TCs using statistical data for neighborhoods of the TCs to select an action for a respective TC, including adjusting the respective TC or maintaining the respective TC.
1 . A method comprising:
generating a block of predicted pixels that approximates a block of source pixels of an image frame;
representing a difference between the block of source pixels and the block of predicted pixels via a plurality of transformation coefficients (TCs);
applying, to the plurality of TCs, a quantization transformation to obtain a plurality of quantization coefficients (QCs);
evaluating QCs of at least a subset of the plurality of QCs in parallel, wherein each of the QCs is evaluated in parallel with one or more other QCs using statistical data for a neighborhood of QCs associated with a respective QC, to select an action for the respective QC, the action comprising:
adjusting the respective QC, or
maintaining the respective QC; and
generating a compressed representation of the image frame using the evaluated QCs.
2 . The method of claim 1 , wherein the block of predicted pixels comprises pixels predicted using at least one of:
reference pixels of one or more reference image frames different from the image frame, or
reconstructed pixels of the image frame.
3 . The method of claim 1 , wherein representing the difference between the block of source pixels and the block of predicted pixels via the plurality of TCs comprises applying a discrete linear transformation to the difference.
4 . The method of claim 1 , wherein adjusting the respective QC is responsive to a first cost value associated with an adjustment of the respective QC being less than a second cost value associated with maintaining the respective QC.
5 . The method of claim 1 , wherein evaluating the QCs in parallel comprises:
accessing, for the respective QC, the statistical data for the neighborhood of QCs;
virtually replacing one or more first QCs of the neighborhood of QCs with one or more second QCs based at least on the statistical data; and
evaluating the respective QC using a cost function computed with the virtually replaced one or more first QCs of the neighborhood of QCs.
6 . The method of claim 5 , wherein virtually replacing the one or more first QCs of the neighborhood of QCs is with a most likely historical QC modification of the one or more first QCs of the neighborhood of QCs indicated by the statistical data.
7 . The method of claim 1 , wherein adjusting the respective QC comprises at least one of:
decrementing the respective QC; or
replacing the respective QC with a zero value.
8 . The method of claim 1 , wherein the QCs evaluated in parallel include two or more QCs of the subset of the plurality of QCs.
9 . A system comprising:
a memory device to store a block of source pixels of an image frame; and
one or more circuits communicatively coupled to the memory device, the one or more circuits to:
generate a block of predicted pixels that approximates the block of source pixels of the image frame;
represent a difference between the block of source pixels and the block of predicted pixels via a plurality of transformation coefficients (TCs);
apply, to the plurality of TCs, a quantization transformation to obtain a plurality of quantization coefficients (QCs);
evaluate QCs of at least a subset of the plurality of QCs in parallel, wherein each of the QCs is evaluated in parallel with one or more other QCs using statistical data for a neighborhood of QCs associated with a respective QC, to select an action for the respective QC, the action comprising:
adjusting the respective QC, or
maintaining the respective QC; and
generate a compressed representation of the image frame using the evaluated QCs.
10 . The system of claim 9 , wherein the block of predicted pixels comprises pixels predicted using at least one of:
reference pixels of one or more reference image frames different from the image frame, or
reconstructed pixels of the image frame.
11 . The system of claim 9 , wherein to represent the difference between the block of source pixels and the block of predicted pixels via the plurality of TCs, the one or more circuits are to apply a discrete linear transformation to the difference.
12 . The system of claim 9 , wherein adjusting the respective QC is responsive to a first cost value associated with an adjustment of the respective QC being less than a second cost value associated with maintaining the respective QC.
13 . The system of claim 9 , wherein to evaluate the QCs in parallel, the one or more circuits are to:
access, for the respective QC, the statistical data for the neighborhood of QCs;
virtually replace one or more first QCs of the neighborhood of QCs with one or more second QCs based at least on the statistical data; and
evaluate the respective QC using a cost function computed with the virtually replaced one or more first QCs of the neighborhood of QCs.
14 . The system of claim 13 , wherein to virtually replace the one or more first QCs of the neighborhood of QCs, the one or more circuits are to select a most likely historical QC modification of the one or more first QCs of the neighborhood of QCs indicated by the statistical data.
15 . The system of claim 9 , wherein adjusting the respective QC comprises at least one of:
decrementing the respective QC; or
replacing the respective QC with a zero value.
16 . The system of claim 9 , wherein the QCs evaluated in parallel include two or more QCs of the subset of the plurality of QCs.
17 . A system comprising:
a memory device to store a block of source pixels of an image frame; and
one or more circuit groups communicatively coupled to the memory device, the one or more circuit groups comprising:
a first circuit group to:
generate a block of predicted pixels that approximates the block of source pixels of the image frame; and
a second circuit group communicatively coupled to the first circuit group, the second circuit group to:
represent a difference between the block of source pixels and the block of predicted pixels via a plurality of transformation coefficients (TCs);
apply, to the plurality of TCs, a quantization transformation to obtain a plurality of quantization coefficients (QCs);
evaluate QCs of at least a subset of the plurality of QCs in parallel, wherein each of the QCs is evaluated in parallel with one or more other QCs using statistical data for a neighborhood of QCs associated with a respective QC, to select an action for the respective QC, wherein the action comprises:
adjusting the respective QC, or
maintaining the respective QC; and
generate a compressed representation of the image frame using the evaluated QCs.
18 . The system of claim 17 , wherein to evaluate the QCs in parallel, the second circuit group is to:
access, for the respective QC, the statistical data for the neighborhood of QCs;
virtually replace one or more first QCs of the neighborhood of QCs with one or more second QCs based at least on the statistical data; and
evaluate the respective QC using a cost function computed with the virtually replaced one or more first QCs of the neighborhood of QCs.
19 . The system of claim 17 , wherein adjusting the respective QC comprises at least one of:
decrementing the respective QC; or
replacing the respective QC with a zero value.
20 . The system of claim 17 , wherein the QCs evaluated in parallel include two or more QCs of the subset of the plurality of QCs.