diff options
Diffstat (limited to 'src/video_dec/libvdpau/dpb.h')
-rw-r--r-- | src/video_dec/libvdpau/dpb.h | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/video_dec/libvdpau/dpb.h b/src/video_dec/libvdpau/dpb.h index be4982761..ef57c462c 100644 --- a/src/video_dec/libvdpau/dpb.h +++ b/src/video_dec/libvdpau/dpb.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * dpb.h: Decoder Picture Buffer + * dpb.h: Decoded Picture Buffer */ #ifndef DPB_H_ @@ -26,13 +26,22 @@ #define MAX_DPB_SIZE 16 #include "nal.h" +#include "cpb.h" #include <xine/video_out.h> struct decoded_picture { VdpVideoSurface surface; vo_frame_t *img; /* this is the image we block, to make sure * the surface is not double-used */ - struct nal_unit *nal; + + /** + * a decoded picture always contains a whole frame, + * respective a field pair, so it can contain up to + * 2 coded pics + */ + struct coded_picture *coded_pic[2]; + + int32_t frame_num_wrap; uint8_t used_for_reference; uint8_t top_is_reference; @@ -51,9 +60,18 @@ struct dpb { uint32_t used; }; -struct decoded_picture* init_decoded_picture(struct nal_unit *src_nal, +struct decoded_picture* init_decoded_picture(struct coded_picture *cpic, VdpVideoSurface surface, vo_frame_t *img); void free_decoded_picture(struct decoded_picture *pic); +void dpb_add_coded_picture(struct decoded_picture *pic, + struct coded_picture *cpic); + +/** + * returns the following picture from dpb, that is used for + * reference. if pic == NULL it returns the first ref pic in dpb + */ +struct decoded_picture* dpb_get_next_ref_pic(struct dpb *dpb, + struct decoded_picture *pic); struct decoded_picture* dpb_get_next_out_picture(struct dpb *dpb, int do_flush); @@ -65,7 +83,7 @@ int dpb_set_unused_ref_picture(struct dpb *dpb, uint32_t picnum); int dpb_set_unused_ref_picture_a(struct dpb *dpb, struct decoded_picture *refpic); int dpb_set_unused_ref_picture_byltpn(struct dpb *dpb, uint32_t longterm_picnum); int dpb_set_unused_ref_picture_bylidx(struct dpb *dpb, uint32_t longterm_idx); -int dpb_set_unused_ref_picture_lidx_gt(struct dpb *dpb, uint32_t longterm_idx); +int dpb_set_unused_ref_picture_lidx_gt(struct dpb *dpb, int32_t longterm_idx); int dpb_set_output_picture(struct dpb *dpb, struct decoded_picture *outpic); @@ -77,4 +95,24 @@ void dpb_clear_all_pts( struct dpb *dpb ); int fill_vdpau_reference_list(struct dpb *dpb, VdpReferenceFrameH264 *reflist); +static int dp_top_field_first(struct decoded_picture *decoded_pic) +{ + int top_field_first = 0; + + if (decoded_pic->coded_pic[0] == NULL) { + printf("SOMETHINGS VERY WRONG!\n"); + } + if (decoded_pic->coded_pic[0]->slc_nal->slc.field_pic_flag == 0) { + top_field_first = 1; + } else { + if (decoded_pic->coded_pic[1] != NULL) { + top_field_first = (decoded_pic->coded_pic[0]->top_field_order_cnt <= decoded_pic->coded_pic[1]->bottom_field_order_cnt); + } else { + top_field_first = (decoded_pic->coded_pic[0]->top_field_order_cnt <= decoded_pic->coded_pic[0]->bottom_field_order_cnt); + } + } + + return top_field_first; +} + #endif /* DPB_H_ */ |