Commit 8f110572 authored by David Michael Barr's avatar David Michael Barr Committed by Nathan Egge
Browse files

Use stable sort with PVQ.

Cherry-pick Daala 85433214
 Fully order the pvq search candidates
For portable and stable sorting, break ties.
Large differences in output were observed between AWCY and an OS X
 machine because of the platform qsort implementation.

Change-Id: I294dd2e167c1e0464c7f61f32d60ab478341446e
parent 03ab527a
......@@ -286,7 +286,9 @@ typedef struct {
} pvq_search_item;
int items_compare(pvq_search_item *a, pvq_search_item *b) {
return a->k - b->k;
/* Break ties in K with gain to ensure a stable sort.
Otherwise, the order depends on qsort implementation. */
return a->k == b->k ? a->gain - b->gain : a->k - b->k;
/** Perform PVQ quantization with prediction, trying several
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment