mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
restored original params for JPEG codec
This commit is contained in:
parent
5aac92fc97
commit
49c6c8a1fa
@ -9,7 +9,7 @@
|
||||
#include "QVideoDevice.h"
|
||||
|
||||
VideoProcessor::VideoProcessor()
|
||||
:_encoded_frame_size(256,256)
|
||||
:_encoded_frame_size(128,128)
|
||||
{
|
||||
_decoded_output_device = NULL ;
|
||||
_encoding_current_codec = VIDEO_PROCESSOR_CODEC_ID_JPEG_VIDEO;
|
||||
@ -40,6 +40,8 @@ bool VideoProcessor::processImage(const QImage& img,uint32_t size_hint,uint32_t&
|
||||
|
||||
codec->encodeData(img.scaled(_encoded_frame_size,Qt::IgnoreAspectRatio,Qt::SmoothTransformation),size_hint,chunk) ;
|
||||
|
||||
encoded_size = chunk.size ;
|
||||
|
||||
if(chunk.size == 0) // the codec might be buffering the frame for compression reasons
|
||||
return true ;
|
||||
|
||||
@ -147,7 +149,6 @@ bool JPEGVideo::decodeData(const RsVOIPDataChunk& chunk,QImage& image)
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
||||
if(flags & JPEG_VIDEO_FLAGS_DIFFERENTIAL_FRAME)
|
||||
{
|
||||
if(_decoded_reference_frame.size() != image.size())
|
||||
@ -187,6 +188,9 @@ bool JPEGVideo::encodeData(const QImage& image,uint32_t /* size_hint */,RsVOIPDa
|
||||
|
||||
for(uint32_t i=0;i<image.byteCount();++i)
|
||||
{
|
||||
// We cannot use basic modulo 256 arithmetic, because the decompressed JPeg frames do not follow the same rules (values are clamped)
|
||||
// and cause color blotches when perturbated by a differential frame.
|
||||
|
||||
int diff = ( (int)image.bits()[i] - (int)_encoded_reference_frame.bits()[i]) + 128;
|
||||
encoded_frame.bits()[i] = (unsigned char)std::max(0,std::min(255,diff)) ;
|
||||
}
|
||||
@ -199,7 +203,7 @@ bool JPEGVideo::encodeData(const QImage& image,uint32_t /* size_hint */,RsVOIPDa
|
||||
_encoded_reference_frame = image ;
|
||||
encoded_frame = image ;
|
||||
|
||||
differential_frame = false ;
|
||||
differential_frame = false ;
|
||||
}
|
||||
|
||||
QByteArray qb ;
|
||||
|
Loading…
Reference in New Issue
Block a user