diff options
author | Zhao Yakui <yakui.zhao@intel.com> | 2014-01-13 09:42:32 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2014-02-27 10:30:26 +0800 |
commit | 07cad1269421e3351ba271a235445eb35a6e6170 (patch) | |
tree | 2c5255831af22a331fe3385ef35690505cef65c5 | |
parent | b1b6ceb65a70273345eb8fd87c7805e61bc65791 (diff) | |
download | libva-intel-driver-07cad1269421e3351ba271a235445eb35a6e6170.tar.gz libva-intel-driver-07cad1269421e3351ba271a235445eb35a6e6170.tar.bz2 libva-intel-driver-07cad1269421e3351ba271a235445eb35a6e6170.zip |
Remove the unnecessary sorting to simplify the DPB buffer management
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
-rw-r--r-- | src/i965_decoder_utils.c | 52 |
1 files changed, 11 insertions, 41 deletions
diff --git a/src/i965_decoder_utils.c b/src/i965_decoder_utils.c index e0d0763..30ef372 100644 --- a/src/i965_decoder_utils.c +++ b/src/i965_decoder_utils.c @@ -420,6 +420,7 @@ intel_update_avc_frame_store_index(VADriverContextP ctx, /* add the new reference frame into the internal DPB */ if (!found) { int frame_idx; + int slot_found; struct object_surface *obj_surface = decode_state->reference_objects[i]; /* @@ -428,60 +429,29 @@ intel_update_avc_frame_store_index(VADriverContextP ctx, */ i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC('N', 'V', '1', '2'), SUBSAMPLE_YUV420); + slot_found = 0; + frame_idx = -1; /* Find a free frame store index */ - for (frame_idx = 0; frame_idx < MAX_GEN_REFERENCE_FRAMES; frame_idx++) { - for (j = 0; j < MAX_GEN_REFERENCE_FRAMES; j++) { - if (frame_store[j].surface_id == VA_INVALID_ID || - frame_store[j].obj_surface == NULL) - continue; - - if (frame_store[j].frame_store_id == frame_idx) /* the store index is in use */ - break; - } - - if (j == MAX_GEN_REFERENCE_FRAMES) - break; - } - - assert(frame_idx < MAX_GEN_REFERENCE_FRAMES); - for (j = 0; j < MAX_GEN_REFERENCE_FRAMES; j++) { if (frame_store[j].surface_id == VA_INVALID_ID || frame_store[j].obj_surface == NULL) { - frame_store[j].surface_id = ref_pic->picture_id; - frame_store[j].frame_store_id = frame_idx; - frame_store[j].obj_surface = obj_surface; + frame_idx = j; + slot_found = 1; break; } } - } - } - /* sort */ - for (i = 0; i < MAX_GEN_REFERENCE_FRAMES - 1; i++) { - if (frame_store[i].surface_id != VA_INVALID_ID && - frame_store[i].obj_surface != NULL && - frame_store[i].frame_store_id == i) - continue; - for (j = i + 1; j < MAX_GEN_REFERENCE_FRAMES; j++) { - if (frame_store[j].surface_id != VA_INVALID_ID && - frame_store[j].obj_surface != NULL && - frame_store[j].frame_store_id == i) { - VASurfaceID id = frame_store[i].surface_id; - int frame_idx = frame_store[i].frame_store_id; - struct object_surface *obj_surface = frame_store[i].obj_surface; - - frame_store[i].surface_id = frame_store[j].surface_id; - frame_store[i].frame_store_id = frame_store[j].frame_store_id; - frame_store[i].obj_surface = frame_store[j].obj_surface; - frame_store[j].surface_id = id; + if (slot_found) { + frame_store[j].surface_id = ref_pic->picture_id; frame_store[j].frame_store_id = frame_idx; frame_store[j].obj_surface = obj_surface; - break; - } + } else { + WARN_ONCE("Not free slot for DPB reference list!!!\n"); + } } } + } void |