aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cximage-6.0/CxImage/ximadsp.cpp6
-rw-r--r--lib/cximage-6.0/CxImage/xmemfile.cpp16
-rw-r--r--lib/cximage-6.0/png/pngwutil.c3
-rw-r--r--lib/cximage-6.0/raw/dcraw.c13
-rw-r--r--lib/cximage-6.0/raw/libdcr.c12
-rw-r--r--lib/ffmpeg/libswresample/rematrix.c13
-rw-r--r--lib/ffmpeg/libswresample/swresample.c1
-rw-r--r--lib/ffmpeg/libswresample/swresample_internal.h1
-rw-r--r--lib/ffmpeg/libswresample/version.h2
-rw-r--r--lib/ffmpeg/patches/0057-backport-swresample-Make-rematrix-maxvalue-user-settable.patch84
10 files changed, 134 insertions, 17 deletions
diff --git a/lib/cximage-6.0/CxImage/ximadsp.cpp b/lib/cximage-6.0/CxImage/ximadsp.cpp
index f54ffd615a..a21c0661a3 100644
--- a/lib/cximage-6.0/CxImage/ximadsp.cpp
+++ b/lib/cximage-6.0/CxImage/ximadsp.cpp
@@ -654,6 +654,7 @@ bool CxImage::Colorize(BYTE hue, BYTE sat, float blend)
hsl.rgbRed=hue;
hsl.rgbGreen=sat;
hsl.rgbBlue = (BYTE)RGB2GRAY(color.rgbRed,color.rgbGreen,color.rgbBlue);
+ hsl.rgbReserved = (BYTE)0;
hsl = HSLtoRGB(hsl);
//BlendPixelColor(x,y,hsl,blend);
//color.rgbRed = (BYTE)(hsl.rgbRed * blend + color.rgbRed * (1.0f - blend));
@@ -679,6 +680,7 @@ bool CxImage::Colorize(BYTE hue, BYTE sat, float blend)
hsl.rgbRed=hue;
hsl.rgbGreen=sat;
hsl.rgbBlue = (BYTE)RGB2GRAY(color.rgbRed,color.rgbGreen,color.rgbBlue);
+ hsl.rgbReserved = (BYTE)0;
hsl = HSLtoRGB(hsl);
color.rgbRed = (BYTE)(hsl.rgbRed * blend + color.rgbRed * (1.0f - blend));
color.rgbBlue = (BYTE)(hsl.rgbBlue * blend + color.rgbBlue * (1.0f - blend));
@@ -1802,6 +1804,7 @@ bool CxImage::Combine(CxImage* r,CxImage* g,CxImage* b,CxImage* a, long colorspa
c.rgbRed=r->GetPixelIndex(x,y);
c.rgbGreen=g->GetPixelIndex(x,y);
c.rgbBlue=b->GetPixelIndex(x,y);
+ c.rgbReserved = (BYTE)0;
switch (colorspace){
case 1:
BlindSetPixelColor(x,y,HSLtoRGB(c));
@@ -2700,7 +2703,10 @@ bool CxImage::UnsharpMask(float radius /*= 5.0*/, float amount /*= 0.5*/, int th
pPalette = new RGBQUAD[head.biClrUsed];
memcpy(pPalette, GetPalette(),GetPaletteSize());
if (!IncreaseBpp(24))
+ {
+ delete [] pPalette;
return false;
+ }
}
CxImage iDst;
diff --git a/lib/cximage-6.0/CxImage/xmemfile.cpp b/lib/cximage-6.0/CxImage/xmemfile.cpp
index af8db945a3..5a72200238 100644
--- a/lib/cximage-6.0/CxImage/xmemfile.cpp
+++ b/lib/cximage-6.0/CxImage/xmemfile.cpp
@@ -186,9 +186,21 @@ bool CxMemFile::Alloc(DWORD dwNewLen)
// allocate new buffer
if (m_pBuffer == NULL) m_pBuffer = (BYTE*)malloc(dwNewBufferSize);
- else m_pBuffer = (BYTE*)realloc(m_pBuffer, dwNewBufferSize);
+ else
+ {
+ BYTE* new_buf = (BYTE*)realloc(m_pBuffer, dwNewBufferSize);
+ if (!new_buf)
+ {
+ free(m_pBuffer);
+ m_bFreeOnClose = false;
+ return false;
+ }
+ else
+ m_pBuffer = new_buf;
+ }
// I own this buffer now (caller knows nothing about it)
- m_bFreeOnClose = true;
+ if (m_pBuffer)
+ m_bFreeOnClose = true;
m_Edge = dwNewBufferSize;
}
diff --git a/lib/cximage-6.0/png/pngwutil.c b/lib/cximage-6.0/png/pngwutil.c
index fef38aef9d..7f4ba12f67 100644
--- a/lib/cximage-6.0/png/pngwutil.c
+++ b/lib/cximage-6.0/png/pngwutil.c
@@ -1721,7 +1721,6 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time)
png_write_chunk(png_ptr, png_tIME, buf, (png_size_t)7);
}
#endif
-
/* initializes the row writing capability of libpng */
void /* PRIVATE */
png_write_start_row(png_structp png_ptr)
@@ -1790,8 +1789,8 @@ png_write_start_row(png_structp png_ptr)
(png_ptr->rowbytes + 1));
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
}
-#endif /* PNG_NO_WRITE_FILTERING */
}
+#endif /* PNG_NO_WRITE_FILTERING */
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* if interlaced, we need to set up width and height of pass */
diff --git a/lib/cximage-6.0/raw/dcraw.c b/lib/cximage-6.0/raw/dcraw.c
index d57b9151a4..45cd7a96b4 100644
--- a/lib/cximage-6.0/raw/dcraw.c
+++ b/lib/cximage-6.0/raw/dcraw.c
@@ -3485,6 +3485,7 @@ void CLASS subtract (char *fname)
BAYER(row,col) = MAX (BAYER(row,col) - ntohs(pixel[col]), 0);
}
free (pixel);
+ fclose(fp);
black = 0;
}
@@ -4774,7 +4775,7 @@ void CLASS romm_coeff (float romm_cam[3][3])
void CLASS parse_mos (int offset)
{
char data[40];
- int skip, from, i, c, neut[4], planes=0, frot=0;
+ int skip, from, i, j, c, neut[4], planes=0, frot=0;
static const char *mod[] =
{ "","DCB2","Volare","Cantare","CMost","Valeo 6","Valeo 11","Valeo 22",
"Valeo 11p","Valeo 17","","Aptus 17","Aptus 22","Aptus 75","Aptus 65",
@@ -4802,13 +4803,15 @@ void CLASS parse_mos (int offset)
strcpy (model, mod[i]);
}
if (!strcmp(data,"icc_camera_to_tone_matrix")) {
- for (i=0; i < 9; i++)
- romm_cam[0][i] = int_to_float(get4());
+ for (i=0; i < 3; i++)
+ for (j=0; j < 3; j++)
+ romm_cam[i][j] = int_to_float(get4());
romm_coeff (romm_cam);
}
if (!strcmp(data,"CaptProf_color_matrix")) {
- for (i=0; i < 9; i++)
- fscanf (ifp, "%f", &romm_cam[0][i]);
+ for (i=0; i < 3; i++)
+ for (j=0; j < 3; j++)
+ fscanf (ifp, "%f", &romm_cam[i][j]);
romm_coeff (romm_cam);
}
if (!strcmp(data,"CaptProf_number_of_planes"))
diff --git a/lib/cximage-6.0/raw/libdcr.c b/lib/cximage-6.0/raw/libdcr.c
index 81bf2fb322..ced60c3665 100644
--- a/lib/cximage-6.0/raw/libdcr.c
+++ b/lib/cximage-6.0/raw/libdcr.c
@@ -4735,7 +4735,7 @@ void DCR_CLASS dcr_romm_coeff (DCRAW* p, float romm_cam[3][3])
void DCR_CLASS dcr_parse_mos (DCRAW* p, int offset)
{
char data[40];
- int skip, from, i=0, c, neut[4], planes=0, frot=0;
+ int skip, from, i=0, j, c, neut[4], planes=0, frot=0;
static const char *mod[] =
{ "","DCB2","Volare","Cantare","CMost","Valeo 6","Valeo 11","Valeo 22",
"Valeo 11p","Valeo 17","","Aptus 17","Aptus 22","Aptus 75","Aptus 65",
@@ -4763,13 +4763,15 @@ void DCR_CLASS dcr_parse_mos (DCRAW* p, int offset)
strcpy (p->model, mod[i]);
}
if (!strcmp(data,"icc_camera_to_tone_matrix")) {
- for (i=0; i < 9; i++)
- romm_cam[0][i] = dcr_int_to_float(dcr_get4(p));
+ for (i=0; i < 3; i++)
+ for (j=0; j < 3; j++)
+ romm_cam[i][j] = dcr_int_to_float(dcr_get4(p));
dcr_romm_coeff (p,romm_cam);
}
if (!strcmp(data,"CaptProf_color_matrix")) {
- for (i=0; i < 9; i++)
- dcr_fscanf(p->obj_, "%f", &romm_cam[0][i]);
+ for (i=0; i < 3; i++)
+ for (j=0; j < 3; j++)
+ dcr_fscanf(p->obj_, "%f", &romm_cam[i][j]);
dcr_romm_coeff (p,romm_cam);
}
if (!strcmp(data,"CaptProf_number_of_planes"))
diff --git a/lib/ffmpeg/libswresample/rematrix.c b/lib/ffmpeg/libswresample/rematrix.c
index 51658cee21..8ab554cf90 100644
--- a/lib/ffmpeg/libswresample/rematrix.c
+++ b/lib/ffmpeg/libswresample/rematrix.c
@@ -116,6 +116,7 @@ av_cold static int auto_matrix(SwrContext *s)
double maxcoef=0;
char buf[128];
const int matrix_encoding = s->matrix_encoding;
+ float maxval;
in_ch_layout = clean_layout(s, s->in_ch_layout);
if(!sane_layout(in_ch_layout)){
@@ -300,8 +301,16 @@ av_cold static int auto_matrix(SwrContext *s)
if(s->rematrix_volume < 0)
maxcoef = -s->rematrix_volume;
- if(( av_get_packed_sample_fmt(s->out_sample_fmt) < AV_SAMPLE_FMT_FLT
- || av_get_packed_sample_fmt(s->int_sample_fmt) < AV_SAMPLE_FMT_FLT) && maxcoef > 1.0){
+ if (s->rematrix_maxval > 0) {
+ maxval = s->rematrix_maxval;
+ } else if ( av_get_packed_sample_fmt(s->out_sample_fmt) < AV_SAMPLE_FMT_FLT
+ || av_get_packed_sample_fmt(s->int_sample_fmt) < AV_SAMPLE_FMT_FLT) {
+ maxval = 1.0;
+ } else
+ maxval = INT_MAX;
+
+ if(maxcoef > maxval){
+ maxcoef /= maxval;
for(i=0; i<SWR_CH_MAX; i++)
for(j=0; j<SWR_CH_MAX; j++){
s->matrix[i][j] /= maxcoef;
diff --git a/lib/ffmpeg/libswresample/swresample.c b/lib/ffmpeg/libswresample/swresample.c
index 9b71b2e122..b9c652a931 100644
--- a/lib/ffmpeg/libswresample/swresample.c
+++ b/lib/ffmpeg/libswresample/swresample.c
@@ -68,6 +68,7 @@ static const AVOption options[]={
{"lfe_mix_level" , "set LFE mix level" , OFFSET(lfe_mix_level ), AV_OPT_TYPE_FLOAT, {.dbl=0 }, -32 , 32 , PARAM},
{"rmvol" , "set rematrix volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0 }, -1000 , 1000 , PARAM},
{"rematrix_volume" , "set rematrix volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0 }, -1000 , 1000 , PARAM},
+{"rematrix_maxval" , "set rematrix maxval" , OFFSET(rematrix_maxval), AV_OPT_TYPE_FLOAT, {.dbl=0.0 }, 0 , 1000 , PARAM},
{"flags" , "set flags" , OFFSET(flags ), AV_OPT_TYPE_FLAGS, {.i64=0 }, 0 , UINT_MAX , PARAM, "flags"},
{"swr_flags" , "set flags" , OFFSET(flags ), AV_OPT_TYPE_FLAGS, {.i64=0 }, 0 , UINT_MAX , PARAM, "flags"},
diff --git a/lib/ffmpeg/libswresample/swresample_internal.h b/lib/ffmpeg/libswresample/swresample_internal.h
index 17b85d5263..be36ba6802 100644
--- a/lib/ffmpeg/libswresample/swresample_internal.h
+++ b/lib/ffmpeg/libswresample/swresample_internal.h
@@ -82,6 +82,7 @@ struct SwrContext {
float clev; ///< center mixing level
float lfe_mix_level; ///< LFE mixing level
float rematrix_volume; ///< rematrixing volume coefficient
+ float rematrix_maxval; ///< maximum value for rematrixing output
enum AVMatrixEncoding matrix_encoding; /**< matrixed stereo encoding */
const int *channel_map; ///< channel index (or -1 if muted channel) map
int used_ch_count; ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)
diff --git a/lib/ffmpeg/libswresample/version.h b/lib/ffmpeg/libswresample/version.h
index df9df480c7..8272b763b9 100644
--- a/lib/ffmpeg/libswresample/version.h
+++ b/lib/ffmpeg/libswresample/version.h
@@ -30,7 +30,7 @@
#define LIBSWRESAMPLE_VERSION_MAJOR 0
#define LIBSWRESAMPLE_VERSION_MINOR 17
-#define LIBSWRESAMPLE_VERSION_MICRO 102
+#define LIBSWRESAMPLE_VERSION_MICRO 103
#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
LIBSWRESAMPLE_VERSION_MINOR, \
diff --git a/lib/ffmpeg/patches/0057-backport-swresample-Make-rematrix-maxvalue-user-settable.patch b/lib/ffmpeg/patches/0057-backport-swresample-Make-rematrix-maxvalue-user-settable.patch
new file mode 100644
index 0000000000..b826a613b0
--- /dev/null
+++ b/lib/ffmpeg/patches/0057-backport-swresample-Make-rematrix-maxvalue-user-settable.patch
@@ -0,0 +1,84 @@
+From e2b718464e92fcde3d21c6653c88ddec2ab21c3f Mon Sep 17 00:00:00 2001
+From: Michael Niedermayer <michaelni@gmx.at>
+Date: Mon, 22 Jul 2013 03:23:54 +0200
+Subject: [PATCH] swresample: Make rematrix maxvalue user settable
+
+Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
+---
+ libswresample/rematrix.c | 13 +++++++++++--
+ libswresample/swresample.c | 1 +
+ libswresample/swresample_internal.h | 1 +
+ libswresample/version.h | 2 +-
+ 4 files changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
+index 48aff3b..33e2966 100644
+--- a/libswresample/rematrix.c
++++ b/libswresample/rematrix.c
+@@ -120,6 +120,7 @@ av_cold static int auto_matrix(SwrContext *s)
+ double maxcoef=0;
+ char buf[128];
+ const int matrix_encoding = s->matrix_encoding;
++ float maxval;
+
+ in_ch_layout = clean_layout(s, s->in_ch_layout);
+ if(!sane_layout(in_ch_layout)){
+@@ -304,8 +305,16 @@ av_cold static int auto_matrix(SwrContext *s)
+ if(s->rematrix_volume < 0)
+ maxcoef = -s->rematrix_volume;
+
+- if(( av_get_packed_sample_fmt(s->out_sample_fmt) < AV_SAMPLE_FMT_FLT
+- || av_get_packed_sample_fmt(s->int_sample_fmt) < AV_SAMPLE_FMT_FLT) && maxcoef > 1.0){
++ if (s->rematrix_maxval > 0) {
++ maxval = s->rematrix_maxval;
++ } else if ( av_get_packed_sample_fmt(s->out_sample_fmt) < AV_SAMPLE_FMT_FLT
++ || av_get_packed_sample_fmt(s->int_sample_fmt) < AV_SAMPLE_FMT_FLT) {
++ maxval = 1.0;
++ } else
++ maxval = INT_MAX;
++
++ if(maxcoef > maxval){
++ maxcoef /= maxval;
+ for(i=0; i<SWR_CH_MAX; i++)
+ for(j=0; j<SWR_CH_MAX; j++){
+ s->matrix[i][j] /= maxcoef;
+diff --git a/libswresample/swresample.c b/libswresample/swresample.c
+index ba2afdb..cdfe5bf 100644
+--- a/libswresample/swresample.c
++++ b/libswresample/swresample.c
+@@ -68,6 +68,7 @@
+ {"lfe_mix_level" , "set LFE mix level" , OFFSET(lfe_mix_level ), AV_OPT_TYPE_FLOAT, {.dbl=0 }, -32 , 32 , PARAM},
+ {"rmvol" , "set rematrix volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0 }, -1000 , 1000 , PARAM},
+ {"rematrix_volume" , "set rematrix volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0 }, -1000 , 1000 , PARAM},
++{"rematrix_maxval" , "set rematrix maxval" , OFFSET(rematrix_maxval), AV_OPT_TYPE_FLOAT, {.dbl=0.0 }, 0 , 1000 , PARAM},
+
+ {"flags" , "set flags" , OFFSET(flags ), AV_OPT_TYPE_FLAGS, {.i64=0 }, 0 , UINT_MAX , PARAM, "flags"},
+ {"swr_flags" , "set flags" , OFFSET(flags ), AV_OPT_TYPE_FLAGS, {.i64=0 }, 0 , UINT_MAX , PARAM, "flags"},
+diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h
+index 108f837..ab19f21 100644
+--- a/libswresample/swresample_internal.h
++++ b/libswresample/swresample_internal.h
+@@ -82,6 +82,7 @@ struct SwrContext {
+ float clev; ///< center mixing level
+ float lfe_mix_level; ///< LFE mixing level
+ float rematrix_volume; ///< rematrixing volume coefficient
++ float rematrix_maxval; ///< maximum value for rematrixing output
+ enum AVMatrixEncoding matrix_encoding; /**< matrixed stereo encoding */
+ const int *channel_map; ///< channel index (or -1 if muted channel) map
+ int used_ch_count; ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)
+diff --git a/libswresample/version.h b/libswresample/version.h
+index df9df48..8272b76 100644
+--- a/libswresample/version.h
++++ b/libswresample/version.h
+@@ -30,7 +30,7 @@
+
+ #define LIBSWRESAMPLE_VERSION_MAJOR 0
+ #define LIBSWRESAMPLE_VERSION_MINOR 17
+-#define LIBSWRESAMPLE_VERSION_MICRO 102
++#define LIBSWRESAMPLE_VERSION_MICRO 103
+
+ #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
+ LIBSWRESAMPLE_VERSION_MINOR, \
+--
+1.8.4
+