Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. diff --git a/lib/ffmpeg/libavcodec/h264.c b/lib/ffmpeg/libavcodec/h264.c
  2. index 31d43df..a1aac56 100644
  3. --- a/lib/ffmpeg/libavcodec/h264.c
  4. +++ b/lib/ffmpeg/libavcodec/h264.c
  5. @@ -1723,6 +1723,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
  6. unsigned int slice_type, tmp, i, j;
  7. int default_ref_list_done = 0;
  8. int last_pic_structure;
  9. + unsigned int crop_left, crop_right, crop_top, crop_bottom;
  10.  
  11. s->dropable= h->nal_ref_idc == 0;
  12.  
  13. @@ -1798,11 +1799,30 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
  14.  
  15. h->b_stride= s->mb_width*4;
  16.  
  17. - s->width = 16*s->mb_width - 2*FFMIN(h->sps.crop_right, 7);
  18. - if(h->sps.frame_mbs_only_flag)
  19. - s->height= 16*s->mb_height - 2*FFMIN(h->sps.crop_bottom, 7);
  20. - else
  21. - s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 7);
  22. + s->width = 16*s->mb_width;
  23. + s->height= 16*s->mb_height;
  24. +
  25. + crop_left = 2*FFMIN(h->sps.crop_left, 7);
  26. + crop_right = 2*FFMIN(h->sps.crop_right, 7);
  27. + crop_top = 2*FFMIN(h->sps.crop_top, 7) * (2 - h->sps.frame_mbs_only_flag);
  28. + crop_bottom = 2*FFMIN(h->sps.crop_bottom, 7) * (2 - h->sps.frame_mbs_only_flag);
  29. +
  30. + s->width = 16*s->mb_width;
  31. + s->height= 16*s->mb_height;
  32. +
  33. + if(s->avctx->hwaccel || (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)) {
  34. + h->pan_scan.width = 16 * (s->width - crop_left - crop_right);
  35. + h->pan_scan.height = 16 * (s->height - crop_top - crop_bottom);
  36. + h->pan_scan.position[0][0] = 16 * crop_left;
  37. + h->pan_scan.position[1][0] = 16 * (crop_left >> s->chroma_x_shift);
  38. + h->pan_scan.position[2][0] = 16 * (crop_left >> s->chroma_x_shift);
  39. + h->pan_scan.position[0][1] = 16 * crop_top;
  40. + h->pan_scan.position[1][1] = 16 * (crop_top >> s->chroma_y_shift);
  41. + h->pan_scan.position[2][1] = 16 * (crop_top >> s->chroma_y_shift);
  42. + } else {
  43. + s->width -= crop_right;
  44. + s->height -= crop_bottom;
  45. + }
  46.  
  47. if (s->context_initialized
  48. && ( s->width != s->avctx->width || s->height != s->avctx->height
  49. @@ -3032,7 +3052,7 @@ static int decode_frame(AVCodecContext *avctx,
  50. } else {
  51. cur->interlaced_frame = 0;
  52. cur->repeat_pict = 0;
  53. -
  54. + *cur->pan_scan = h->pan_scan;
  55. /* Signal interlacing information externally. */
  56. /* Prioritize picture timing SEI information over used decoding process if it exists. */
  57.  
  58. diff --git a/lib/ffmpeg/libavcodec/h264.h b/lib/ffmpeg/libavcodec/h264.h
  59. index bdca237..10f60b9 100644
  60. --- a/lib/ffmpeg/libavcodec/h264.h
  61. +++ b/lib/ffmpeg/libavcodec/h264.h
  62. @@ -593,6 +593,8 @@ typedef struct H264Context{
  63. int sei_buffering_period_present; ///< Buffering period SEI flag
  64. int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
  65.  
  66. + AVPanScan pan_scan;
  67. +
  68. //SVQ3 specific fields
  69. int halfpel_flag;
  70. int thirdpel_flag;
  71.  
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement