At 2020-02-27 16:59:18, "Niranjan Bala" <niran...@multicorewareinc.com> wrote: +double computeBrightnessIntensity(pixel *inPlane, int width, int height, intptr_t stride) +{ + pixel* rowStart = inPlane; restrict with const prefix may better. + double count = 0; why declare as Double? + + for (int i = 0; i < height; i++) + { + for (int j = 0; j < width; j++) + { + if (rowStart[j] > BRIGHTNESS_THRESHOLD) + count++; + } + rowStart += stride; + } + + /* Returns the brightness percentage of the input plane */ + return (count / (width * height)) * 100; +} + +double computeEdgeIntensity(pixel *inPlane, int width, int height, intptr_t stride) +{ + pixel* rowStart = inPlane; + double count = 0; + + for (int i = 0; i < height; i++) + { + for (int j = 0; j < width; j++) + { + if (rowStart[j] > 0) + count++; + } + rowStart += stride; + } + + /* Returns the edge percentage of the input plane */ + return (count / (width * height)) * 100; 100 is integer, multiplication with Double.
_______________________________________________ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel