mirror of https://git.ffmpeg.org/ffmpeg.git
swscale/swscale: Get rid of the SWS_GAMMA_CORRECT flag
This avoids using up a bit of the public flags Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
2a7128f4ed
commit
b57f9f5724
|
@ -369,7 +369,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
|
|||
int chrBufIndex = c->chrBufIndex;
|
||||
int lastInLumBuf = c->lastInLumBuf;
|
||||
int lastInChrBuf = c->lastInChrBuf;
|
||||
int perform_gamma = c->flags & SWS_GAMMA_CORRECT;
|
||||
int perform_gamma = c->is_internal_gamma;
|
||||
|
||||
|
||||
if (!usePal(c->srcFormat)) {
|
||||
|
|
|
@ -64,7 +64,6 @@ const char *swscale_license(void);
|
|||
#define SWS_SINC 0x100
|
||||
#define SWS_LANCZOS 0x200
|
||||
#define SWS_SPLINE 0x400
|
||||
#define SWS_GAMMA_CORRECT 0x800
|
||||
|
||||
#define SWS_SRC_V_CHR_DROP_MASK 0x30000
|
||||
#define SWS_SRC_V_CHR_DROP_SHIFT 16
|
||||
|
|
|
@ -315,6 +315,7 @@ typedef struct SwsContext {
|
|||
|
||||
double gamma_value;
|
||||
int gamma_flag;
|
||||
int is_internal_gamma;
|
||||
uint16_t *gamma;
|
||||
uint16_t *inv_gamma;
|
||||
|
||||
|
|
|
@ -1256,6 +1256,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
|||
|
||||
|
||||
if (!unscaled && c->gamma_flag && (srcFormat != tmpFmt || dstFormat != tmpFmt)) {
|
||||
SwsContext *c2;
|
||||
c->cascaded_context[0] = NULL;
|
||||
|
||||
ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride,
|
||||
|
@ -1272,11 +1273,18 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
|||
|
||||
c->cascaded_context[1] = sws_getContext(srcW, srcH, tmpFmt,
|
||||
dstW, dstH, tmpFmt,
|
||||
flags | SWS_GAMMA_CORRECT, srcFilter, dstFilter, c->param);
|
||||
flags, srcFilter, dstFilter, c->param);
|
||||
|
||||
if (!c->cascaded_context[1])
|
||||
return -1;
|
||||
|
||||
c2 = c->cascaded_context[1];
|
||||
c2->is_internal_gamma = 1;
|
||||
c2->gamma = alloc_gamma_tbl( c->gamma_value);
|
||||
c2->inv_gamma = alloc_gamma_tbl(1.f/c->gamma_value);
|
||||
if (!c2->gamma || !c2->inv_gamma)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
c->cascaded_context[2] = NULL;
|
||||
if (dstFormat != tmpFmt) {
|
||||
ret = av_image_alloc(c->cascaded1_tmp, c->cascaded1_tmpStride,
|
||||
|
@ -1293,18 +1301,6 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
|||
return 0;
|
||||
}
|
||||
|
||||
c->gamma = NULL;
|
||||
c->inv_gamma = NULL;
|
||||
if (c->flags & SWS_GAMMA_CORRECT) {
|
||||
c->gamma = alloc_gamma_tbl(c->gamma_value);
|
||||
if (!c->gamma)
|
||||
return AVERROR(ENOMEM);
|
||||
c->inv_gamma = alloc_gamma_tbl(1.f/c->gamma_value);
|
||||
if (!c->inv_gamma) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
}
|
||||
|
||||
if (isBayer(srcFormat)) {
|
||||
if (!unscaled ||
|
||||
(dstFormat != AV_PIX_FMT_RGB24 && dstFormat != AV_PIX_FMT_YUV420P)) {
|
||||
|
|
Loading…
Reference in New Issue