Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HSV Support #816

Merged
merged 7 commits into from
Jul 24, 2014
Merged

HSV Support #816

merged 7 commits into from
Jul 24, 2014

Conversation

wiredfool
Copy link
Member

  • Support for storage of HSV images.
  • Support for conversion to and from RGB.

No known load/save support.

@wiredfool
Copy link
Member Author

The DOS of pypy is real -- apparantly image.putdata is the culprit.

real    1m32.421s
user    1m29.086s
sys 0m3.304s
(vpypy)erics@builder-1204-x64:~/Pillow$ more pypyprofile.out 
         1017487 function calls (1015234 primitive calls) in 64.424 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.004    0.004   64.424   64.424 profile:0(nose.main())
        1    0.000    0.000   64.420   64.420 core.py:102(__init__)
     20/1    0.000    0.000   64.420   64.420 <string>:1(<module>)
        1    0.000    0.000   64.236   64.236 main.py:72(__init__)
        1    0.008    0.008   63.184   63.184 core.py:195(runTests)
        1    0.000    0.000   63.176   63.176 core.py:46(run)
      4/1    0.000    0.000   63.172   63.172 suite.py:196(run)
      4/1    0.000    0.000   63.172   63.172 suite.py:175(__call__)
        4    0.000    0.000   63.148   15.787 case.py:44(__call__)
        4    0.000    0.000   63.148   15.787 case.py:115(run)
        4    0.004    0.001   63.144   15.786 case.py:142(runTest)
        4    0.004    0.001   63.140   15.785 case.py:394(__call__)
        4    0.000    0.000   63.136   15.784 helper.py:26(run)
        4    0.000    0.000   63.136   15.784 case.py:297(run)
        4    5.580    1.395   54.079   13.520 test_format_hsv.py:46(to_xxx_colorsys)
        1    0.000    0.000   38.594   38.594 test_format_hsv.py:156(test_hsv_to_rgb)
       12   37.086    3.091   37.106    3.092 Image.py:1417(putdata)
        3    0.000    0.000   36.814   12.271 test_format_hsv.py:93(to_hsv_colorsys)
        1    0.000    0.000   21.909   21.909 test_format_hsv.py:138(test_convert)
        1    0.000    0.000   17.265   17.265 test_format_hsv.py:96(to_rgb_colorsys)
       12    3.804    0.317    7.472    0.623 helper.py:83(assert_image_similar)
   156672    4.608    0.000    6.376    0.000 test_format_hsv.py:11(str_to_float)
   391034    4.168    0.000    4.168    0.000 :0(ord)
        1    0.000    0.000    2.620    2.620 test_format_hsv.py:99(test_wedge)
    35840    1.644    0.000    2.500    0.000 colorsys.py:116(rgb_to_hsv)
   156672    2.204    0.000    2.204    0.000 test_format_hsv.py:13(to_int)
       88    0.008    0.000    1.536    0.017 re.py:226(_compile)
       33    0.000    0.000    1.528    0.046 re.py:188(compile)
       32    0.008    0.000    1.516    0.047 sre_compile.py:493(compile)

@wiredfool
Copy link
Member Author

Removing Image.putdata

(vpypy)erics@builder-1204-x64:~/Pillow$ more pypyprofile3.out 
         1121645 function calls (1119392 primitive calls) in 28.250 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.004    0.004   28.250   28.250 profile:0(nose.main())
        1    0.000    0.000   28.242   28.242 core.py:102(__init__)
     20/1    0.004    0.000   28.242   28.242 <string>:1(<module>)
        1    0.000    0.000   27.926   27.926 main.py:72(__init__)
        1    0.000    0.000   26.742   26.742 core.py:195(runTests)
        1    0.000    0.000   26.742   26.742 core.py:46(run)
      4/1    0.000    0.000   26.742   26.742 suite.py:196(run)
      4/1    0.000    0.000   26.742   26.742 suite.py:175(__call__)
        4    0.000    0.000   26.734    6.683 case.py:44(__call__)
        4    0.000    0.000   26.734    6.683 case.py:115(run)
        4    0.000    0.000   26.730    6.682 case.py:297(run)
        4    0.000    0.000   26.730    6.682 case.py:394(__call__)
        4    0.000    0.000   26.730    6.682 helper.py:26(run)
        4    0.000    0.000   26.730    6.682 case.py:142(runTest)
        4    3.468    0.867   17.849    4.462 test_format_hsv.py:49(to_xxx_colorsys)
        1    0.000    0.000   13.597   13.597 test_format_hsv.py:162(test_hsv_to_rgb)
        3    0.000    0.000   13.081    4.360 test_format_hsv.py:99(to_hsv_colorsys)
        1    0.000    0.000   10.861   10.861 test_format_hsv.py:144(test_convert)
       12    3.608    0.301    7.248    0.604 helper.py:83(assert_image_similar)
   156672    4.156    0.000    5.732    0.000 test_format_hsv.py:11(str_to_float)
      456    0.544    0.001    4.792    0.011 :0(join)
        1    0.000    0.000    4.768    4.768 test_format_hsv.py:102(to_rgb_colorsys)
    52228    2.404    0.000    4.248    0.000 test_format_hsv.py:85(<genexpr>)
   391034    3.944    0.000    3.944    0.000 :0(ord)
    35840    1.648    0.000    2.648    0.000 colorsys.py:116(rgb_to_hsv)
        1    0.004    0.004    2.260    2.260 test_format_hsv.py:105(test_wedge)
   157896    1.884    0.000    1.884    0.000 :0(chr)
       88    0.020    0.000    1.660    0.019 re.py:226(_compile)
       33    0.000    0.000    1.652    0.050 re.py:188(compile)
       32    0.008    0.000    1.624    0.051 sre_compile.py:493(compile)

My theory is that Image.putdata is slow because it accesses each element of the python list from C code, which for pypy is a really pair of really slow traversals across the python->c api boundary.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) when pulling 67c235b on wiredfool:hsv into af4c3c9 on python-pillow:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) when pulling e14e359 on wiredfool:hsv into af4c3c9 on python-pillow:master.

hugovk added a commit that referenced this pull request Jul 24, 2014
@hugovk hugovk merged commit 352f1fd into python-pillow:master Jul 24, 2014
@Yay295 Yay295 mentioned this pull request Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants