Open ardabada opened 1 month ago
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.
:white_check_mark: ardabada
:white_check_mark: JimBobSquarePants
:x: Alexandr Ivanov
Wow! Thanks @ardabada
Tests are failing just now due to a minor StyleCop issue (trailing space) would it be possible to fix that and add some additional unit tests to verify the encoded output?
@br3aker would you be able to help review this? It reuses most of the work you implemented.
Hi @JimBobSquarePants, I've added a test. The test suite seems quite complicated to me, and I need more time to understand how it works before I can write more complex, byte-level tests.
I've also split the WriteBlock
method into two separate methods: WriteDc
and WriteAcBlock
. This change was necessary because the progressive encoder requires different values in the for loop when writing AC components. Additionally, I've updated the final if statement for writing the end of the block to check runLength > 0
instead of lastValuableIndex
, since runLength
is reset when encountering a non-zero coefficient. I hope this makes sense. CC @br3aker
I'd like to add a restart interval as well, but it seems to require more changes. WriteMarker
is currently in JpegEncoderCore
, and it should be called from HuffmanScanEncoder
, which isn't an ideal solution. Therefore, I will postpone this for now.
Hi @JimBobSquarePants, I've added a test. The test suite seems quite complicated to me, and I need more time to understand how it works before I can write more complex, byte-level tests.
I've also split the
WriteBlock
method into two separate methods:WriteDc
andWriteAcBlock
. This change was necessary because the progressive encoder requires different values in the for loop when writing AC components. Additionally, I've updated the final if statement for writing the end of the block to checkrunLength > 0
instead oflastValuableIndex
, sincerunLength
is reset when encountering a non-zero coefficient. I hope this makes sense. CC @br3akerI'd like to add a restart interval as well, but it seems to require more changes.
WriteMarker
is currently inJpegEncoderCore
, and it should be called fromHuffmanScanEncoder
, which isn't an ideal solution. Therefore, I will postpone this for now.
Thanks for the updates! I've no issue with duplicate WriteMarker
calls for now if you find it easier to go that way..
I'll pull down your code ASAP and have a good read through. Maybe I can help write tests.
Hi @ardabada apologies for the slow response. The code all looks great so far!
I think you can either
WriteMarkerHeader
method to the HuffmanScanEncoder
. WriteMarkerHeader
static and internal passing the stream as a parameter. I'm happy with whatever approach you take.
For tests I would keep it high level and simply encode/verify the output against expected results.
Prerequisites
Description
This PR adds progressive JPEG encoder (see #10 and #449). Implementation adapted from https://github.com/vstroebel/jpeg-encoder
No tests added yet. Restart interval also should be added. Please take a look if it makes sense to you.