forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ImageConverter.outData() must shifted because of aligning. wang-bin#1046
- Loading branch information
Showing
2 changed files
with
8 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
ImageConverter: Base class for image resizing & color model convertion | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -45,7 45,8 @@ ImageConverter::~ImageConverter() | |
|
||
QByteArray ImageConverter::outData() const | ||
{ | ||
return d_func().data_out; | ||
DPTR_D(const ImageConverter); | ||
return QByteArray::fromRawData(d.data_out.constData() d.out_offset, d.data_out.size() - d.out_offset); | ||
} | ||
|
||
bool ImageConverter::check() const | ||
|
@@ -224,8 225,8 @@ bool ImageConverter::prepareData() | |
if (s < 0) | ||
return false; | ||
d.data_out.resize(s kAlign-1); | ||
const int offset = (kAlign - ((uintptr_t)d.data_out.constData() & (kAlign-1))) & (kAlign-1); | ||
AV_ENSURE(av_image_fill_pointers((uint8_t**)d.bits.constData(), d.fmt_out, d.h_out, (uint8_t*)d.data_out.constData() offset, d.pitchs.constData()), false); | ||
d.out_offset = (kAlign - ((uintptr_t)d.data_out.constData() & (kAlign-1))) & (kAlign-1); | ||
AV_ENSURE(av_image_fill_pointers((uint8_t**)d.bits.constData(), d.fmt_out, d.h_out, (uint8_t*)d.data_out.constData() d.out_offset, d.pitchs.constData()), false); | ||
// TODO: special formats | ||
//if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) | ||
// avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -43,6 43,7 @@ class ImageConverterPrivate : public DPtrPrivate<ImageConverter> | |
, contrast(0) | ||
, saturation(0) | ||
, update_data(true) | ||
, out_offset(0) | ||
{ | ||
bits.reserve(8); | ||
pitchs.reserve(8); | ||
|
@@ -57,6 58,7 @@ class ImageConverterPrivate : public DPtrPrivate<ImageConverter> | |
ColorRange range_in, range_out; | ||
int brightness, contrast, saturation; | ||
bool update_data; | ||
int out_offset; | ||
QByteArray data_out; | ||
QVector<quint8*> bits; | ||
QVector<int> pitchs; | ||
|