JPEG compression using DCT
up vote
0
down vote
favorite
I am a little confused about the Huffman code. So as I read the books, it states that after the zigzag ordering, it will be the run length encoding and the Huffman for the run length. I have 3 questions:
1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale). I mean like could I just scan the block 8x8 and count the frequency of appearance of characters, then create the codewords.
2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image.
3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused.
Thank you for helping me out
This is the link for the Annex K
https://www.w3.org/Graphics/JPEG/itu-t81.pdf
image compression jpeg huffman-code dct
add a comment |
up vote
0
down vote
favorite
I am a little confused about the Huffman code. So as I read the books, it states that after the zigzag ordering, it will be the run length encoding and the Huffman for the run length. I have 3 questions:
1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale). I mean like could I just scan the block 8x8 and count the frequency of appearance of characters, then create the codewords.
2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image.
3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused.
Thank you for helping me out
This is the link for the Annex K
https://www.w3.org/Graphics/JPEG/itu-t81.pdf
image compression jpeg huffman-code dct
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am a little confused about the Huffman code. So as I read the books, it states that after the zigzag ordering, it will be the run length encoding and the Huffman for the run length. I have 3 questions:
1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale). I mean like could I just scan the block 8x8 and count the frequency of appearance of characters, then create the codewords.
2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image.
3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused.
Thank you for helping me out
This is the link for the Annex K
https://www.w3.org/Graphics/JPEG/itu-t81.pdf
image compression jpeg huffman-code dct
I am a little confused about the Huffman code. So as I read the books, it states that after the zigzag ordering, it will be the run length encoding and the Huffman for the run length. I have 3 questions:
1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale). I mean like could I just scan the block 8x8 and count the frequency of appearance of characters, then create the codewords.
2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image.
3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused.
Thank you for helping me out
This is the link for the Annex K
https://www.w3.org/Graphics/JPEG/itu-t81.pdf
image compression jpeg huffman-code dct
image compression jpeg huffman-code dct
asked Nov 9 at 15:59
Thịnh Nguyễn
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You COULD compress like you are saying but it would not be JPEG. The encoding process is rather complicated in JPEG. It is not really Huffman encoding of values. It is Huffman encoding of instructions on zero runs and the number of additional raw bits that have to be read.
1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale).
For it to be a JPEG stream, you have to do both.
2) 2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image.
Some encoders do that to generate optimum Huffman tables.
3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused.
Some encoders do that to avoid having to make two passes over the DCT data to generate Huffman tables.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53229184%2fjpeg-compression-using-dct%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You COULD compress like you are saying but it would not be JPEG. The encoding process is rather complicated in JPEG. It is not really Huffman encoding of values. It is Huffman encoding of instructions on zero runs and the number of additional raw bits that have to be read.
1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale).
For it to be a JPEG stream, you have to do both.
2) 2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image.
Some encoders do that to generate optimum Huffman tables.
3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused.
Some encoders do that to avoid having to make two passes over the DCT data to generate Huffman tables.
add a comment |
up vote
0
down vote
You COULD compress like you are saying but it would not be JPEG. The encoding process is rather complicated in JPEG. It is not really Huffman encoding of values. It is Huffman encoding of instructions on zero runs and the number of additional raw bits that have to be read.
1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale).
For it to be a JPEG stream, you have to do both.
2) 2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image.
Some encoders do that to generate optimum Huffman tables.
3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused.
Some encoders do that to avoid having to make two passes over the DCT data to generate Huffman tables.
add a comment |
up vote
0
down vote
up vote
0
down vote
You COULD compress like you are saying but it would not be JPEG. The encoding process is rather complicated in JPEG. It is not really Huffman encoding of values. It is Huffman encoding of instructions on zero runs and the number of additional raw bits that have to be read.
1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale).
For it to be a JPEG stream, you have to do both.
2) 2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image.
Some encoders do that to generate optimum Huffman tables.
3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused.
Some encoders do that to avoid having to make two passes over the DCT data to generate Huffman tables.
You COULD compress like you are saying but it would not be JPEG. The encoding process is rather complicated in JPEG. It is not really Huffman encoding of values. It is Huffman encoding of instructions on zero runs and the number of additional raw bits that have to be read.
1) Is it necessary to do both run length encoding and Huffman, or just Huffman for the whole image( which is gray scale).
For it to be a JPEG stream, you have to do both.
2) 2) If I use the run length coding for each block, so the Huffman is also for each block of 8x8, or I have to scan through all the whole image.
Some encoders do that to generate optimum Huffman tables.
3) In the book it states that we could just use the Table K.3 and Table K.5 in Annex K for the DC and AC coefficient encoding. Could I not use those tables and generate my own based on the theory in question 2 which Im also confused.
Some encoders do that to avoid having to make two passes over the DCT data to generate Huffman tables.
answered Nov 9 at 23:42
user3344003
14.2k31437
14.2k31437
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53229184%2fjpeg-compression-using-dct%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown