Is it possible to encode and decode jpeg by blocks?












2















I want to develop some very specific UDP protocol, with following workflow:



enter image description here



It is very simple in design, and very "realtim'ish", in contrast to stubs like HTTP MJPEG streaming technique: it could fully utulize even narrow channel to deliever as much updates as quickly as possible. Drawbacks are that delivery not guranteed, and frame start and end are not determined - with each packet you know just that "some blocks at that coordinates just have been updated"



But I am very new to libjpeg api. How is it possible to encode frame, but then split bitstream, to pack in packet only "integer" amount of DCT-ized and huffman-encoded blocks? (as it stated in article on how JPEG works)



So can reword the task - Given encoded jpeg file; the goal is to split data stream to chunks up to some maximum size in such a way, that each chunk would contain just suffient data to decode it. (No chunk concatenation is allowed)










share|improve this question

























  • What's the intended use? Why can't you just encode portions of the image?

    – ivan_pozdeev
    Jan 20 at 3:43











  • Also note that JPEG is only good for photo-type images, so it's not a good choice for e.g. screencasting.

    – ivan_pozdeev
    Jan 20 at 3:47






  • 1





    @ivan_pozdeev I want to encode portions of image. Each portion must be not more that 1400 bytes (encoded size) and contain integer number of encoded blocks, to be able to decode each portion separately on reciever side. How to do that? Its not screencasting, any parts of image CAN BE LOST due to Ethernet packet loss, it is appreciated, along with commonly known compression artifacts. And unfortunately, question lacks information about global fields of usage and jpeg applications, but instead is trying to focus on a narrow very specific task.

    – xakepp35
    Jan 20 at 3:56


















2















I want to develop some very specific UDP protocol, with following workflow:



enter image description here



It is very simple in design, and very "realtim'ish", in contrast to stubs like HTTP MJPEG streaming technique: it could fully utulize even narrow channel to deliever as much updates as quickly as possible. Drawbacks are that delivery not guranteed, and frame start and end are not determined - with each packet you know just that "some blocks at that coordinates just have been updated"



But I am very new to libjpeg api. How is it possible to encode frame, but then split bitstream, to pack in packet only "integer" amount of DCT-ized and huffman-encoded blocks? (as it stated in article on how JPEG works)



So can reword the task - Given encoded jpeg file; the goal is to split data stream to chunks up to some maximum size in such a way, that each chunk would contain just suffient data to decode it. (No chunk concatenation is allowed)










share|improve this question

























  • What's the intended use? Why can't you just encode portions of the image?

    – ivan_pozdeev
    Jan 20 at 3:43











  • Also note that JPEG is only good for photo-type images, so it's not a good choice for e.g. screencasting.

    – ivan_pozdeev
    Jan 20 at 3:47






  • 1





    @ivan_pozdeev I want to encode portions of image. Each portion must be not more that 1400 bytes (encoded size) and contain integer number of encoded blocks, to be able to decode each portion separately on reciever side. How to do that? Its not screencasting, any parts of image CAN BE LOST due to Ethernet packet loss, it is appreciated, along with commonly known compression artifacts. And unfortunately, question lacks information about global fields of usage and jpeg applications, but instead is trying to focus on a narrow very specific task.

    – xakepp35
    Jan 20 at 3:56
















2












2








2








I want to develop some very specific UDP protocol, with following workflow:



enter image description here



It is very simple in design, and very "realtim'ish", in contrast to stubs like HTTP MJPEG streaming technique: it could fully utulize even narrow channel to deliever as much updates as quickly as possible. Drawbacks are that delivery not guranteed, and frame start and end are not determined - with each packet you know just that "some blocks at that coordinates just have been updated"



But I am very new to libjpeg api. How is it possible to encode frame, but then split bitstream, to pack in packet only "integer" amount of DCT-ized and huffman-encoded blocks? (as it stated in article on how JPEG works)



So can reword the task - Given encoded jpeg file; the goal is to split data stream to chunks up to some maximum size in such a way, that each chunk would contain just suffient data to decode it. (No chunk concatenation is allowed)










share|improve this question
















I want to develop some very specific UDP protocol, with following workflow:



enter image description here



It is very simple in design, and very "realtim'ish", in contrast to stubs like HTTP MJPEG streaming technique: it could fully utulize even narrow channel to deliever as much updates as quickly as possible. Drawbacks are that delivery not guranteed, and frame start and end are not determined - with each packet you know just that "some blocks at that coordinates just have been updated"



But I am very new to libjpeg api. How is it possible to encode frame, but then split bitstream, to pack in packet only "integer" amount of DCT-ized and huffman-encoded blocks? (as it stated in article on how JPEG works)



So can reword the task - Given encoded jpeg file; the goal is to split data stream to chunks up to some maximum size in such a way, that each chunk would contain just suffient data to decode it. (No chunk concatenation is allowed)







jpeg huffman-code mjpeg libjpeg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 20 at 3:28







xakepp35

















asked Jan 20 at 3:16









xakepp35xakepp35

892617




892617













  • What's the intended use? Why can't you just encode portions of the image?

    – ivan_pozdeev
    Jan 20 at 3:43











  • Also note that JPEG is only good for photo-type images, so it's not a good choice for e.g. screencasting.

    – ivan_pozdeev
    Jan 20 at 3:47






  • 1





    @ivan_pozdeev I want to encode portions of image. Each portion must be not more that 1400 bytes (encoded size) and contain integer number of encoded blocks, to be able to decode each portion separately on reciever side. How to do that? Its not screencasting, any parts of image CAN BE LOST due to Ethernet packet loss, it is appreciated, along with commonly known compression artifacts. And unfortunately, question lacks information about global fields of usage and jpeg applications, but instead is trying to focus on a narrow very specific task.

    – xakepp35
    Jan 20 at 3:56





















  • What's the intended use? Why can't you just encode portions of the image?

    – ivan_pozdeev
    Jan 20 at 3:43











  • Also note that JPEG is only good for photo-type images, so it's not a good choice for e.g. screencasting.

    – ivan_pozdeev
    Jan 20 at 3:47






  • 1





    @ivan_pozdeev I want to encode portions of image. Each portion must be not more that 1400 bytes (encoded size) and contain integer number of encoded blocks, to be able to decode each portion separately on reciever side. How to do that? Its not screencasting, any parts of image CAN BE LOST due to Ethernet packet loss, it is appreciated, along with commonly known compression artifacts. And unfortunately, question lacks information about global fields of usage and jpeg applications, but instead is trying to focus on a narrow very specific task.

    – xakepp35
    Jan 20 at 3:56



















What's the intended use? Why can't you just encode portions of the image?

– ivan_pozdeev
Jan 20 at 3:43





What's the intended use? Why can't you just encode portions of the image?

– ivan_pozdeev
Jan 20 at 3:43













Also note that JPEG is only good for photo-type images, so it's not a good choice for e.g. screencasting.

– ivan_pozdeev
Jan 20 at 3:47





Also note that JPEG is only good for photo-type images, so it's not a good choice for e.g. screencasting.

– ivan_pozdeev
Jan 20 at 3:47




1




1





@ivan_pozdeev I want to encode portions of image. Each portion must be not more that 1400 bytes (encoded size) and contain integer number of encoded blocks, to be able to decode each portion separately on reciever side. How to do that? Its not screencasting, any parts of image CAN BE LOST due to Ethernet packet loss, it is appreciated, along with commonly known compression artifacts. And unfortunately, question lacks information about global fields of usage and jpeg applications, but instead is trying to focus on a narrow very specific task.

– xakepp35
Jan 20 at 3:56







@ivan_pozdeev I want to encode portions of image. Each portion must be not more that 1400 bytes (encoded size) and contain integer number of encoded blocks, to be able to decode each portion separately on reciever side. How to do that? Its not screencasting, any parts of image CAN BE LOST due to Ethernet packet loss, it is appreciated, along with commonly known compression artifacts. And unfortunately, question lacks information about global fields of usage and jpeg applications, but instead is trying to focus on a narrow very specific task.

– xakepp35
Jan 20 at 3:56














0






active

oldest

votes











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',
autoActivateHeartbeat: false,
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54273296%2fis-it-possible-to-encode-and-decode-jpeg-by-blocks%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54273296%2fis-it-possible-to-encode-and-decode-jpeg-by-blocks%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

How can a duplicate class be excluded from sbt assembly?

Cakephp 3.6: Create new view with dropdown and check boxes

database size increased after restoring on another drive