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

Cython smp #1735

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Cython smp #1735

wants to merge 12 commits into from

Conversation

jere8184
Copy link
Contributor

@jere8184 jere8184 commented Dec 27, 2024

Closes #1370.

@jere8184 jere8184 force-pushed the cython_smp branch 6 times, most recently from 695b2ba to b3f3391 Compare December 30, 2024 04:25
@jere8184
Copy link
Contributor Author

should I add @9a24f0 to .mailmap or copying.md?

Copy link
Member

@heinezen heinezen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made comments to the SMX file only, but they apply to the SMP file in the same way. The graphics seem to convert fine, so there are only structural changes left to do.

openage/convert/value_object/read/media/smx.pyx Outdated Show resolved Hide resolved
openage/convert/value_object/read/media/smx.pyx Outdated Show resolved Hide resolved
Comment on lines 59 to 60
}
cdef class SMXMainLayer8to5(SMXLayer):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declarations should be separated by at two spaces.

Suggested change
}
cdef class SMXMainLayer8to5(SMXLayer):
}
cdef class SMXMainLayer8to5(SMXLayer):

openage/convert/value_object/read/media/smx.pyx Outdated Show resolved Hide resolved
Comment on lines 737 to 750
# memory pointer
cdef const uint8_t[::1] data_raw

# current command
cdef int cmd_offset

# current color
cdef int color_offset

# current chunk position
cdef int chunk_pos

# rows
cdef size_t row_count
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we would want to promote these variables to members instead of keeping them local? All of these members are never accessed again after the layer has been read. Keeping data_raw around is especially resource-intensive because we would store the whole original graphics file in memory well after it was used.

Comment on lines 1044 to 807
cdef numpy.ndarray determine_rgba_matrix(vector[vector[pixel]] &image_matrix,
numpy.ndarray[numpy.uint8_t, ndim=2, mode="c"] palette):
cdef numpy.ndarray determine_rgba_matrix(vector[vector[pixel]] & image_matrix,
numpy.ndarray[numpy.uint8_t, ndim= 2, mode = "c"] palette):
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are unecessary and might als break Cython syntax.

openage/convert/value_object/read/media/smx.pyx Outdated Show resolved Hide resolved
openage/convert/value_object/read/media/smx.pyx Outdated Show resolved Hide resolved
openage/convert/value_object/read/media/smx.pyx Outdated Show resolved Hide resolved
@heinezen
Copy link
Member

heinezen commented Jan 8, 2025

should I add @9a24f0 to .mailmap or copying.md?

If you based your changes on their code, then yes, you have to add them to copying.md.

@TheJJ TheJJ added the kevin-rebuild-pl0x instruct kevin to rebuild this pull request label Jan 14, 2025
@SFTbot SFTbot removed the kevin-rebuild-pl0x instruct kevin to rebuild this pull request label Jan 14, 2025
@jere8184
Copy link
Contributor Author

jere8184 commented Jan 19, 2025

@heinezen I've restructured the changes, please take a look. passing a variable of type Variant through the base class constructor e.g. super().__init__(......) was causing compilation errors so instead I created a function 'init' which essentially acts as the constructor for the base classes, maybe I was doing something silly though :. Either way, I think the structure is better now.

@jere8184 jere8184 requested a review from heinezen January 19, 2025 15:38
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.

Use cython fused types (templated functions) to remove redundancy from smp.pyx and smx.pyx
5 participants