Showing the changes to vp9/decoder (1 of 5 files). Show all
Unified · Split
| @@ -704,20 +704,19 @@ static void apply_frame_size(VP9D_COMP *pbi, int width, int height) { · 703 unmodified lines | ||
| 704 | 704 | VP9_COMMON *cm = &pbi->common; |
| 705 | 705 | |
| 706 | 706 | if (cm->width != width || cm->height != height) { |
| 707 | − if (!pbi->initial_width || !pbi->initial_height) { | |
| 708 | − if (vp9_alloc_frame_buffers(cm, width, height)) | |
| 707 | + // Change in frame size. | |
| 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 | 718 | vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, |
| 710 | 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 | 722 | cm->width = width; |