[FFmpeg-devel] [PATCH]Lagarith decoder.

Reimar Döffinger Reimar.Doeffinger
Sun Dec 13 21:51:10 CET 2009


On Sat, Oct 24, 2009 at 10:54:33PM -0600, Nathan Caldwell wrote:
> >> + ? ? ? ? ? ?read +=
> >> + ? ? ? ? ? ? ? ?lag_decode_line(l, &rac, dst + (i * stride), width,
> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?stride, step, esc_count);
> >> +
> >> + ? ? ? ? ? ? ? ?src +=
> >> + ? ? ? ? ? ? ? ? ? ?lag_decode_zero_run_line(l, dst + (i * stride),
> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? src, width, step, esc_count);
> >
> > The function calls on the next line look weird.
> 
> indent's doing. Fixed.
> Since these are all cosmetic, changes in the next patch.

Any chances you can send a patch with the changes you already did?

+    if (l->low >= range_scaled * l->prob[255]) {
+        val = 255;
+        l->range -= range_scaled * l->prob[255];
+    } else {
[...]
+        l->range = range_scaled * (l->prob[val + 1] - l->prob[val]);
+    }
+
+    l->low -= range_scaled * l->prob[val];

Maybe this could be "simplified" to

+    if (l->low >= range_scaled * l->prob[255]) {
+        val = 255;
+        range_upper = l->range;
+    } else {
[...]
+        range_upper = range_scaled * l->prob[val + 1];
+    }
+
+    range_lower = range_scaled * l->prob[val];
+    l->range = range_upper - range_lower;
+    l->low -= range_lower;

Assuming the intermediate terms would not overflow.
Not useful speed-wise, just maybe a bit clearer on the idea behind the code...



More information about the ffmpeg-devel mailing list