History

fix scalling bug by buffer auto-reallocation

Adrian Grange committed 13 years ago

Commit 38144ed1 parent e6b72d05 files · +68 −14Browse files

Showing the changes to vp9/decoder (1 of 5 files). Show all

Unified · Split

vp9/decoder/vp9_decodframe.c+11−12
@@ -704,20 +704,19 @@ static void apply_frame_size(VP9D_COMP *pbi, int width, int height) { · 703 unmodified lines
704 VP9_COMMON *cm = &pbi->common;704 VP9_COMMON *cm = &pbi->common;
705 705
706 if (cm->width != width || cm->height != height) {706 if (cm->width != width || cm->height != height) {
707 if (!pbi->initial_width || !pbi->initial_height) {707 // Change in frame size.
708 if (vp9_alloc_frame_buffers(cm, width, height))708 if (cm->width == 0 || cm->height == 0) {
709 // Assign new frame buffer on first call.
710 cm->new_fb_idx = NUM_YV12_BUFFERS - 1;
711 cm->fb_idx_ref_cnt[cm->new_fb_idx] = 1;
712 }
713
714 // TODO(agrange) Don't test width/height, check overall size.
715 if (width > cm->width || height > cm->height) {
716 // Rescale frame buffers only if they're not big enough already.
717 if (vp9_resize_frame_buffers(cm, width, height))
709 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,718 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
710 "Failed to allocate frame buffers");719 "Failed to allocate frame buffers");
711 pbi->initial_width = width;
712 pbi->initial_height = height;
713 } else {
714 if (width > pbi->initial_width)
715 vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
716 "Frame width too large");
717
718 if (height > pbi->initial_height)
719 vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
720 "Frame height too large");
721 }720 }
722 721
723 cm->width = width;722 cm->width = width;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t