Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: libavcodec/vp3.c

Issue 9373002: Fix valgrind and asan memory leaks and crashes. (Closed) Base URL: ssh://gerrit.chromium.org:29418/chromium/third_party/ffmpeg.git@master
Patch Set: Make vp3 fix an ignore. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « libavcodec/vorbisdec.c ('k') | libavcodec/vp8.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003-2004 the ffmpeg project 2 * Copyright (C) 2003-2004 the ffmpeg project
3 * 3 *
4 * This file is part of FFmpeg. 4 * This file is part of FFmpeg.
5 * 5 *
6 * FFmpeg is free software; you can redistribute it and/or 6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public 7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version. 9 * version 2.1 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 { 392 {
393 int *bounding_values= s->bounding_values_array+127; 393 int *bounding_values= s->bounding_values_array+127;
394 int filter_limit; 394 int filter_limit;
395 int x; 395 int x;
396 int value; 396 int value;
397 397
398 filter_limit = s->filter_limit_values[s->qps[0]]; 398 filter_limit = s->filter_limit_values[s->qps[0]];
399 399
400 /* set up the bounding values */ 400 /* set up the bounding values */
401 memset(s->bounding_values_array, 0, 256 * sizeof(int)); 401 memset(s->bounding_values_array, 0, 256 * sizeof(int));
402 for (x = 0; x < filter_limit; x++) { 402 for (x = 0; x < filter_limit && x < 128; x++) {
403 bounding_values[-x] = -x; 403 bounding_values[-x] = -x;
404 bounding_values[x] = x; 404 bounding_values[x] = x;
405 } 405 }
406 for (x = value = filter_limit; x < 128 && value; x++, value--) { 406 for (x = value = filter_limit; x < 128 && value; x++, value--) {
407 bounding_values[ x] = value; 407 bounding_values[ x] = value;
408 bounding_values[-x] = -value; 408 bounding_values[-x] = -value;
409 } 409 }
410 if (value) 410 if (value)
411 bounding_values[128] = value; 411 bounding_values[128] = value;
412 bounding_values[129] = bounding_values[130] = filter_limit * 0x02020202; 412 bounding_values[129] = bounding_values[130] = filter_limit * 0x02020202;
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 { 1623 {
1624 Vp3DecodeContext *s = avctx->priv_data; 1624 Vp3DecodeContext *s = avctx->priv_data;
1625 int y_fragment_count, c_fragment_count; 1625 int y_fragment_count, c_fragment_count;
1626 1626
1627 y_fragment_count = s->fragment_width[0] * s->fragment_height[0]; 1627 y_fragment_count = s->fragment_width[0] * s->fragment_height[0];
1628 c_fragment_count = s->fragment_width[1] * s->fragment_height[1]; 1628 c_fragment_count = s->fragment_width[1] * s->fragment_height[1];
1629 1629
1630 s->superblock_coding = av_malloc(s->superblock_count); 1630 s->superblock_coding = av_malloc(s->superblock_count);
1631 s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment)); 1631 s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment));
1632 s->coded_fragment_list[0] = av_malloc(s->fragment_count * sizeof(int)); 1632 s->coded_fragment_list[0] = av_malloc(s->fragment_count * sizeof(int));
1633 s->dct_tokens_base = av_malloc(64*s->fragment_count * sizeof(*s->dct_tokens_ base)); 1633 s->dct_tokens_base = av_mallocz(64*s->fragment_count * sizeof(*s->dct_tokens _base));
1634 s->motion_val[0] = av_malloc(y_fragment_count * sizeof(*s->motion_val[0])); 1634 s->motion_val[0] = av_malloc(y_fragment_count * sizeof(*s->motion_val[0]));
1635 s->motion_val[1] = av_malloc(c_fragment_count * sizeof(*s->motion_val[1])); 1635 s->motion_val[1] = av_malloc(c_fragment_count * sizeof(*s->motion_val[1]));
1636 1636
1637 /* work out the block mapping tables */ 1637 /* work out the block mapping tables */
1638 s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int)); 1638 s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int));
1639 s->macroblock_coding = av_malloc(s->macroblock_count + 1); 1639 s->macroblock_coding = av_malloc(s->macroblock_count + 1);
1640 1640
1641 if (!s->superblock_coding || !s->all_fragments || !s->dct_tokens_base || 1641 if (!s->superblock_coding || !s->all_fragments || !s->dct_tokens_base ||
1642 !s->coded_fragment_list[0] || !s->superblock_fragments || !s->macroblock _coding || 1642 !s->coded_fragment_list[0] || !s->superblock_fragments || !s->macroblock _coding ||
1643 !s->motion_val[0] || !s->motion_val[1]) { 1643 !s->motion_val[0] || !s->motion_val[1]) {
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 .priv_data_size = sizeof(Vp3DecodeContext), 2391 .priv_data_size = sizeof(Vp3DecodeContext),
2392 .init = vp3_decode_init, 2392 .init = vp3_decode_init,
2393 .close = vp3_decode_end, 2393 .close = vp3_decode_end,
2394 .decode = vp3_decode_frame, 2394 .decode = vp3_decode_frame,
2395 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAM E_THREADS, 2395 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAM E_THREADS,
2396 .flush = vp3_decode_flush, 2396 .flush = vp3_decode_flush,
2397 .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"), 2397 .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
2398 .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy), 2398 .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy),
2399 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) 2399 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context)
2400 }; 2400 };
OLDNEW
« no previous file with comments | « libavcodec/vorbisdec.c ('k') | libavcodec/vp8.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698