A method for decoding an encoded video block from a bitstream, the method comprising: deriving syntax elements representative of the encoded video block from the bitstream; determining a probability distribution for the syntax elements; extracting a set of features from video data decoded from the bitstream Z by identifying the set of features based on one or more of video data associated with the encoded video block, video data associated with one or more neighbor blocks of the encoded video block, or coding modes used for decoding the one or more neighbor blocks, and wherein the set of features corresponds to differences in pixel values of the encoded video block along one or more different directions; processing the probability distribution and the set of features using machine learning to produce a refined probability distribution by: computing a normalized histogram of oriented gradients based on the one or more different directions of the differences in pixel values; and producing the refined probability distribution by updating the probability distribution based on the normalized histogram of oriented gradients; entropy decoding the syntax elements according to the refined probability distribution to produce quantized transform coefficients; dequantizing the quantized transform coefficients to produce transform coefficients; inverse transforming the transform coefficients to produce a prediction residual; reconstructing the prediction residual to produce a decoded video block; and outputting the decoded video block to an output video stream. deriving syntax elements representative of the encoded video block from the bitstream; determining a probability distribution for the syntax elements; extracting a set of features from video data decoded from the bitstream Z by identifying the set of features based on one or more of video data associated with the encoded video block, video data associated with one or more neighbor blocks of the encoded video block, or coding modes used for decoding the one or more neighbor blocks, and wherein the set of features corresponds to differences in pixel values of the encoded video block along one or more different directions; processing the probability distribution and the set of features using machine learning to produce a refined probability distribution by: computing a normalized histogram of oriented gradients based on the one or more different directions of the differences in pixel values; and producing the refined probability distribution by updating the probability distribution based on the normalized histogram of oriented gradients; computing a normalized histogram of oriented gradients based on the one or more different directions of the differences in pixel values; and producing the refined probability distribution by updating the probability distribution based on the normalized histogram of oriented gradients; entropy decoding the syntax elements according to the refined probability distribution to produce quantized transform coefficients; dequantizing the quantized transform coefficients to produce transform coefficients; inverse transforming the transform coefficients to produce a prediction residual; reconstructing the prediction residual to produce a decoded video block; and outputting the decoded video block to an output video stream.