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

Side by Side Diff: source/patched-ffmpeg-mt/libavcodec/vp3.c

Issue 3384002: ffmpeg source update for sep 09 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: Created 10 years, 3 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 | Annotate | Revision Log
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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 if (HAVE_PTHREADS && s->avctx->active_thread_type&FF_THREAD_FRAME) { 1332 if (HAVE_PTHREADS && s->avctx->active_thread_type&FF_THREAD_FRAME) {
1333 int y_flipped = s->flipped_image ? s->height-y : y; 1333 int y_flipped = s->flipped_image ? s->height-y : y;
1334 1334
1335 ff_thread_report_progress(&s->current_frame, y_flipped==s->height ? s->h eight : y_flipped-1, 0); 1335 ff_thread_report_progress(&s->current_frame, y_flipped==s->height ? s->h eight : y_flipped-1, 0);
1336 } 1336 }
1337 1337
1338 if(s->avctx->draw_horiz_band==NULL) 1338 if(s->avctx->draw_horiz_band==NULL)
1339 return; 1339 return;
1340 1340
1341 h= y - s->last_slice_end; 1341 h= y - s->last_slice_end;
1342 s->last_slice_end= y;
1342 y -= h; 1343 y -= h;
1343 1344
1344 if (!s->flipped_image) { 1345 if (!s->flipped_image) {
1345 if (y == 0) 1346 y = s->avctx->height - y - h;
1346 h -= s->height - s->avctx->height; // account for non-mod16
1347 y = s->height - y - h;
1348 } 1347 }
1349 1348
1350 cy = y >> s->chroma_y_shift; 1349 cy = y >> s->chroma_y_shift;
1351 offset[0] = s->current_frame.linesize[0]*y; 1350 offset[0] = s->current_frame.linesize[0]*y;
1352 offset[1] = s->current_frame.linesize[1]*cy; 1351 offset[1] = s->current_frame.linesize[1]*cy;
1353 offset[2] = s->current_frame.linesize[2]*cy; 1352 offset[2] = s->current_frame.linesize[2]*cy;
1354 offset[3] = 0; 1353 offset[3] = 0;
1355 1354
1356 emms_c(); 1355 emms_c();
1357 s->avctx->draw_horiz_band(s->avctx, &s->current_frame, offset, y, 3, h); 1356 s->avctx->draw_horiz_band(s->avctx, &s->current_frame, offset, y, 3, h);
1358 s->last_slice_end= y + h;
1359 } 1357 }
1360 1358
1361 /** 1359 /**
1362 * Wait for the reference frame of a fragment. 1360 * Wait for the reference frame of a fragment.
1363 * Units used are luma pixel rows. 1361 * Units used are luma pixel rows.
1364 */ 1362 */
1365 static void await_reference_row(Vp3DecodeContext *s, Vp3Fragment *fragment, int motion_y, int y) 1363 static void await_reference_row(Vp3DecodeContext *s, Vp3Fragment *fragment, int motion_y, int y)
1366 { 1364 {
1367 AVFrame *ref_frame; 1365 AVFrame *ref_frame;
1368 int border = motion_y&1; 1366 int border = motion_y&1;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 } 1546 }
1549 1547
1550 /* this looks like a good place for slice dispatch... */ 1548 /* this looks like a good place for slice dispatch... */
1551 /* algorithm: 1549 /* algorithm:
1552 * if (slice == s->macroblock_height - 1) 1550 * if (slice == s->macroblock_height - 1)
1553 * dispatch (both last slice & 2nd-to-last slice); 1551 * dispatch (both last slice & 2nd-to-last slice);
1554 * else if (slice > 0) 1552 * else if (slice > 0)
1555 * dispatch (slice - 1); 1553 * dispatch (slice - 1);
1556 */ 1554 */
1557 1555
1558 vp3_draw_horiz_band(s, FFMIN(64*slice + 64-16, s->height-16)); 1556 vp3_draw_horiz_band(s, FFMIN((32 << s->chroma_y_shift) * (slice + 1) -16, s- >height-16));
1559 } 1557 }
1560 1558
1561 /// Allocate tables for frame data in Vp3DecodeContext 1559 /// Allocate tables for frame data in Vp3DecodeContext
1562 static av_cold int allocate_tables(AVCodecContext *avctx) 1560 static av_cold int allocate_tables(AVCodecContext *avctx)
1563 { 1561 {
1564 Vp3DecodeContext *s = avctx->priv_data; 1562 Vp3DecodeContext *s = avctx->priv_data;
1565 int y_fragment_count, c_fragment_count; 1563 int y_fragment_count, c_fragment_count;
1566 1564
1567 y_fragment_count = s->fragment_width[0] * s->fragment_height[0]; 1565 y_fragment_count = s->fragment_width[0] * s->fragment_height[0];
1568 c_fragment_count = s->fragment_width[1] * s->fragment_height[1]; 1566 c_fragment_count = s->fragment_width[1] * s->fragment_height[1];
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 1970
1973 s->last_slice_end = 0; 1971 s->last_slice_end = 0;
1974 for (i = 0; i < s->c_superblock_height; i++) 1972 for (i = 0; i < s->c_superblock_height; i++)
1975 render_slice(s, i); 1973 render_slice(s, i);
1976 1974
1977 // filter the last row 1975 // filter the last row
1978 for (i = 0; i < 3; i++) { 1976 for (i = 0; i < 3; i++) {
1979 int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1; 1977 int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1;
1980 apply_loop_filter(s, i, row, row+1); 1978 apply_loop_filter(s, i, row, row+1);
1981 } 1979 }
1982 vp3_draw_horiz_band(s, s->height); 1980 vp3_draw_horiz_band(s, s->avctx->height);
1983 1981
1984 *data_size=sizeof(AVFrame); 1982 *data_size=sizeof(AVFrame);
1985 *(AVFrame*)data= s->current_frame; 1983 *(AVFrame*)data= s->current_frame;
1986 1984
1987 if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) 1985 if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME))
1988 update_frames(avctx); 1986 update_frames(avctx);
1989 1987
1990 return buf_size; 1988 return buf_size;
1991 1989
1992 error: 1990 error:
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 #if CONFIG_THEORA_DECODER 2079 #if CONFIG_THEORA_DECODER
2082 static const enum PixelFormat theora_pix_fmts[4] = { 2080 static const enum PixelFormat theora_pix_fmts[4] = {
2083 PIX_FMT_YUV420P, PIX_FMT_NONE, PIX_FMT_YUV422P, PIX_FMT_YUV444P 2081 PIX_FMT_YUV420P, PIX_FMT_NONE, PIX_FMT_YUV422P, PIX_FMT_YUV444P
2084 }; 2082 };
2085 2083
2086 static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) 2084 static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
2087 { 2085 {
2088 Vp3DecodeContext *s = avctx->priv_data; 2086 Vp3DecodeContext *s = avctx->priv_data;
2089 int visible_width, visible_height, colorspace; 2087 int visible_width, visible_height, colorspace;
2090 int offset_x = 0, offset_y = 0; 2088 int offset_x = 0, offset_y = 0;
2091 AVRational fps; 2089 AVRational fps, aspect;
2092 2090
2093 s->theora = get_bits_long(gb, 24); 2091 s->theora = get_bits_long(gb, 24);
2094 av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora); 2092 av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
2095 2093
2096 /* 3.2.0 aka alpha3 has the same frame orientation as original vp3 */ 2094 /* 3.2.0 aka alpha3 has the same frame orientation as original vp3 */
2097 /* but previous versions have the image flipped relative to vp3 */ 2095 /* but previous versions have the image flipped relative to vp3 */
2098 if (s->theora < 0x030200) 2096 if (s->theora < 0x030200)
2099 { 2097 {
2100 s->flipped_image = 1; 2098 s->flipped_image = 1;
2101 av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped ima ge\n"); 2099 av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped ima ge\n");
2102 } 2100 }
2103 2101
2104 visible_width = s->width = get_bits(gb, 16) << 4; 2102 visible_width = s->width = get_bits(gb, 16) << 4;
2105 visible_height = s->height = get_bits(gb, 16) << 4; 2103 visible_height = s->height = get_bits(gb, 16) << 4;
2106 2104
2107 if(av_check_image_size(s->width, s->height, 0, avctx)){ 2105 if(av_image_check_size(s->width, s->height, 0, avctx)){
2108 av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s- >height); 2106 av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s- >height);
2109 s->width= s->height= 0; 2107 s->width= s->height= 0;
2110 return -1; 2108 return -1;
2111 } 2109 }
2112 2110
2113 if (s->theora >= 0x030200) { 2111 if (s->theora >= 0x030200) {
2114 visible_width = get_bits_long(gb, 24); 2112 visible_width = get_bits_long(gb, 24);
2115 visible_height = get_bits_long(gb, 24); 2113 visible_height = get_bits_long(gb, 24);
2116 2114
2117 offset_x = get_bits(gb, 8); /* offset x */ 2115 offset_x = get_bits(gb, 8); /* offset x */
2118 offset_y = get_bits(gb, 8); /* offset y, from bottom */ 2116 offset_y = get_bits(gb, 8); /* offset y, from bottom */
2119 } 2117 }
2120 2118
2121 fps.num = get_bits_long(gb, 32); 2119 fps.num = get_bits_long(gb, 32);
2122 fps.den = get_bits_long(gb, 32); 2120 fps.den = get_bits_long(gb, 32);
2123 if (fps.num && fps.den) { 2121 if (fps.num && fps.den) {
2124 av_reduce(&avctx->time_base.num, &avctx->time_base.den, 2122 av_reduce(&avctx->time_base.num, &avctx->time_base.den,
2125 fps.den, fps.num, 1<<30); 2123 fps.den, fps.num, 1<<30);
2126 } 2124 }
2127 2125
2128 avctx->sample_aspect_ratio.num = get_bits_long(gb, 24); 2126 aspect.num = get_bits_long(gb, 24);
2129 avctx->sample_aspect_ratio.den = get_bits_long(gb, 24); 2127 aspect.den = get_bits_long(gb, 24);
2128 if (aspect.num && aspect.den) {
2129 av_reduce(&avctx->sample_aspect_ratio.num,
2130 &avctx->sample_aspect_ratio.den,
2131 aspect.num, aspect.den, 1<<30);
2132 }
2130 2133
2131 if (s->theora < 0x030200) 2134 if (s->theora < 0x030200)
2132 skip_bits(gb, 5); /* keyframe frequency force */ 2135 skip_bits(gb, 5); /* keyframe frequency force */
2133 colorspace = get_bits(gb, 8); 2136 colorspace = get_bits(gb, 8);
2134 skip_bits(gb, 24); /* bitrate */ 2137 skip_bits(gb, 24); /* bitrate */
2135 2138
2136 skip_bits(gb, 6); /* quality hint */ 2139 skip_bits(gb, 6); /* quality hint */
2137 2140
2138 if (s->theora >= 0x030200) 2141 if (s->theora >= 0x030200)
2139 { 2142 {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 sizeof(Vp3DecodeContext), 2365 sizeof(Vp3DecodeContext),
2363 vp3_decode_init, 2366 vp3_decode_init,
2364 NULL, 2367 NULL,
2365 vp3_decode_end, 2368 vp3_decode_end,
2366 vp3_decode_frame, 2369 vp3_decode_frame,
2367 CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, 2370 CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS,
2368 NULL, 2371 NULL,
2369 .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"), 2372 .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
2370 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) 2373 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context)
2371 }; 2374 };
OLDNEW
« no previous file with comments | « source/patched-ffmpeg-mt/libavcodec/vorbis_dec.c ('k') | source/patched-ffmpeg-mt/libavcodec/vp56.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698