On 8/31/20, Andreas Rheinhardt <andreas.rheinha...@gmail.com> wrote:
> When the MagicYUV decoder builds Huffman tables from an array of code
> lengths, it proceeds as follows: First it copies the entries of the
> array of lengths into an array of HuffEntries (a struct which contains
> a length and a symbol field); it also sets the symbol field in
> descending order from nb_elem - 1 to 0, where nb_elem is the common number
> of elements of the length and HuffEntry arrays. Then the HuffEntry array
> is sorted lexicographically: a > b iff a.len > b.len or a.len == b.len and
> a.sym > b.sym. Afterwards the symbols of the so sorted array are
> inverted again (i.e. each symbol sym is replaced by nb_elem - sym).
>
> Yet inverting can easily be avoided altogether: Just modify the order so
> that smaller symbols correspond to bigger HuffEntries. This leads to the
> same permutation as the current code does and given that the two
> inversions just cancel each other out, the result is the same.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com>
> ---
>  libavcodec/magicyuv.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>

LGTM whole patch set.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to