[FFmpeg-devel] [PATCH 4/5] j2kenc: fix compiler warning for uninitialized variables
Michael Niedermayer
michaelni at gmx.at
Tue Jan 3 04:08:20 CET 2012
On Tue, Jan 03, 2012 at 12:28:07AM +0100, Jean First wrote:
>
> Signed-off-by: Jean First <jeanfirst at gmail.com>
> ---
> libavcodec/j2kenc.c | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
> index 37e31a9..b77ce52 100644
> --- a/libavcodec/j2kenc.c
> +++ b/libavcodec/j2kenc.c
> @@ -438,7 +438,8 @@ static void init_quantization(J2kEncoderContext *s)
> int nbands, lev = codsty->nreslevels - reslevelno - 1;
> nbands = reslevelno ? 3 : 1;
> for (bandno = 0; bandno < nbands; bandno++, gbandno++){
> - int expn, mant;
> + int expn;
> + int mant = 0;
>
> if (codsty->transform == FF_DWT97){
> int bandpos = bandno + (reslevelno>0),
It looks like the implementation of the else is missing something
setting variables to 0 hides the warning but wont implement whats
missing ...
I think its better to leave the warning until the missing code is
written ... as a reminder
[...]
> @@ -491,7 +492,7 @@ static int getnmsedec_ref(int x, int bpno)
> static void encode_sigpass(J2kT1Context *t1, int width, int height, int bandno, int *nmsedec, int bpno)
> {
> int y0, x, y, mask = 1 << (bpno + NMSEDEC_FRACBITS);
> - int vert_causal_ctx_csty_loc_symbol;
> + int vert_causal_ctx_csty_loc_symbol = 0;
> for (y0 = 0; y0 < height; y0 += 4)
> for (x = 0; x < width; x++)
> for (y = y0; y < height && y < y0+4; y++){
> @@ -528,7 +529,7 @@ static void encode_refpass(J2kT1Context *t1, int width, int height, int *nmsedec
> static void encode_clnpass(J2kT1Context *t1, int width, int height, int bandno, int *nmsedec, int bpno)
> {
> int y0, x, y, mask = 1 << (bpno + NMSEDEC_FRACBITS);
> - int vert_causal_ctx_csty_loc_symbol;
> + int vert_causal_ctx_csty_loc_symbol = 0;
> for (y0 = 0; y0 < height; y0 += 4)
> for (x = 0; x < width; x++){
> if (y0 + 3 < height && !(
same here
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120103/979e8920/attachment.asc>
More information about the ffmpeg-devel
mailing list