]> granicus.if.org Git - libvpx/commitdiff
Merge remote branch 'internal/upstream-experimental' into HEAD
authorJohn Koleszar <jkoleszar@google.com>
Mon, 7 Feb 2011 19:16:09 +0000 (14:16 -0500)
committerJohn Koleszar <jkoleszar@google.com>
Mon, 7 Feb 2011 19:16:09 +0000 (14:16 -0500)
Conflicts:
vp8/encoder/encodeframe.c
vp8/encoder/ethreading.c
vp8/encoder/onyx_int.h

Change-Id: I1c562d2fe6e42c0d1d86f68c77c0e899066e02bd

1  2 
vp8/encoder/encodeframe.c
vp8/encoder/ethreading.c
vp8/encoder/onyx_if.c
vp8/encoder/onyx_int.h

index 07aa18fd9bf24d71d3200ceb01627c4f3be84e80,92f200da2fb3fbb5011dde0323ebbe8357a58c47..88e8d02b8f957c082cafcdde76dc8878ab6f6a23
@@@ -494,10 -479,18 +487,20 @@@ void encode_mb_row(VP8_COMP *cpi
      int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride;
      int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride;
      int seg_map_index = (mb_row * cpi->common.mb_cols);
 -
 +#if CONFIG_SEGMENTATION
 +    int left_id, above_id;
 +    int sum;
++#endif
+ #if CONFIG_MULTITHREAD
+     const int nsync = cpi->mt_sync_range;
+     const int rightmost_col = cm->mb_cols - 1;
+     volatile const int *last_row_current_mb_col;
+     if ((cpi->b_multi_threaded != 0) && (mb_row != 0))
+         last_row_current_mb_col = &cpi->mt_current_mb_col[mb_row - 1];
+     else
+         last_row_current_mb_col = &rightmost_col;
  #endif
 -
      // reset above block coeffs
      xd->above_context = cm->above_context;
  
      xd->mode_info_context++;
      x->partition_info++;
      x->activity_sum += activity_sum;
 -
+ #if CONFIG_MULTITHREAD
+     if ((cpi->b_multi_threaded != 0) && (mb_row == cm->mb_rows - 1))
+     {
+         sem_post(&cpi->h_event_end_encoding); /* signal frame encoding end */
+     }
+ #endif
  }
--
  void vp8_encode_frame(VP8_COMP *cpi)
  {
      int mb_row;
index bf03560e11fc647fde949c8ab7afcfb9841e66d0,8da93a67c20f1d0267a183410393996df0091941..d3f3bc4caaf24215da76c2e01ec2f680e1ae1745
@@@ -38,57 -40,59 +40,59 @@@ THREAD_FUNCTION thread_encoding_proc(vo
              break;
  
          //if(WaitForSingleObject(cpi->h_event_mbrencoding[ithread], INFINITE) == WAIT_OBJECT_0)
-         if (sem_wait(&cpi->h_event_mbrencoding[ithread]) == 0)
+         if (sem_wait(&cpi->h_event_start_encoding[ithread]) == 0)
          {
+             VP8_COMMON *cm = &cpi->common;
+             int mb_row;
+             MACROBLOCK *x = &mbri->mb;
+             MACROBLOCKD *xd = &x->e_mbd;
+             TOKENEXTRA *tp ;
+             int *segment_counts = mbri->segment_counts;
+             int *totalrate = &mbri->totalrate;
              if (cpi->b_multi_threaded == FALSE) // we're shutting down
                  break;
-             else
+             for (mb_row = ithread + 1; mb_row < cm->mb_rows; mb_row += (cpi->encoding_thread_count + 1))
              {
-                 VP8_COMMON *cm      = &cpi->common;
-                 int mb_row           = mbri->mb_row;
-                 MACROBLOCK  *x      = &mbri->mb;
-                 MACROBLOCKD *xd     = &x->e_mbd;
-                 TOKENEXTRA **tp     = &mbri->tp;
-                 int *segment_counts  = mbri->segment_counts;
-                 int *totalrate      = &mbri->totalrate;
  
-                 {
-                     int i;
-                     int recon_yoffset, recon_uvoffset;
-                     int mb_col;
-                     int ref_fb_idx = cm->lst_fb_idx;
-                     int dst_fb_idx = cm->new_fb_idx;
-                     int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride;
-                     int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride;
-                     volatile int *last_row_current_mb_col;
-                     INT64 activity_sum = 0;
-                     if (ithread > 0)
-                         last_row_current_mb_col = &cpi->mb_row_ei[ithread-1].current_mb_col;
-                     else
-                         last_row_current_mb_col = &cpi->current_mb_col_main;
+                 int i;
+                 int recon_yoffset, recon_uvoffset;
+                 int mb_col;
+                 int ref_fb_idx = cm->lst_fb_idx;
+                 int dst_fb_idx = cm->new_fb_idx;
+                 int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride;
+                 int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride;
+                 volatile int *last_row_current_mb_col;
+                 INT64 activity_sum = 0;
  
-                     // reset above block coeffs
-                     xd->above_context = cm->above_context;
-                     xd->left_context = &mb_row_left_context;
+                 tp = cpi->tok + (mb_row * (cm->mb_cols * 16 * 24));
  
-                     vp8_zero(mb_row_left_context);
+                 last_row_current_mb_col = &cpi->mt_current_mb_col[mb_row - 1];
  
-                     xd->up_available = (mb_row != 0);
-                     recon_yoffset = (mb_row * recon_y_stride * 16);
-                     recon_uvoffset = (mb_row * recon_uv_stride * 8);
+                 // reset above block coeffs
+                 xd->above_context = cm->above_context;
+                 xd->left_context = &mb_row_left_context;
  
+                 vp8_zero(mb_row_left_context);
  
-                     cpi->tplist[mb_row].start = *tp;
+                 xd->up_available = (mb_row != 0);
+                 recon_yoffset = (mb_row * recon_y_stride * 16);
+                 recon_uvoffset = (mb_row * recon_uv_stride * 8);
  
-                     //printf("Thread mb_row = %d\n", mb_row);
+                 cpi->tplist[mb_row].start = tp;
  
-                     // for each macroblock col in image
-                     for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
-                     {
-                         int seg_map_index = (mb_row * cm->mb_cols);
+                 //printf("Thread mb_row = %d\n", mb_row);
+                 // for each macroblock col in image
+                 for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
+                 {
+                     int seg_map_index = (mb_row * cm->mb_cols);
 -
 +   
-                         while (mb_col > (*last_row_current_mb_col - 1) && *last_row_current_mb_col != cm->mb_cols - 1)
+                     if ((mb_col & (nsync - 1)) == 0)
+                     {
+                         while (mb_col > (*last_row_current_mb_col - nsync) && *last_row_current_mb_col != cm->mb_cols - 1)
                          {
                              x86_pause_hint();
                              thread_sleep(0);
index b56696d0add15fc0cd8e7a35d8039d2bb7d695c2,1f5006ee1ab7e4a76798306d51930d0883b50120..1821f6c53280bf23b7eb5d3c2c20ddd5cb9fed58
@@@ -3673,11 -3697,18 +3693,22 @@@ static void encode_frame_to_data_rat
  
      // Test code for segmentation of gf/arf (0,0)
      //segmentation_test_function((VP8_PTR) cpi);
 +#if CONFIG_SEGMENTATION
 +    cpi->mb.e_mbd.segmentation_enabled = 1;
 +    cpi->mb.e_mbd.update_mb_segmentation_map = 1;
 +#endif
  
+ #if CONFIG_REALTIME_ONLY
+     if(cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME)
+     {
+         if(cpi->force_next_frame_intra)
+         {
+             cm->frame_type = KEY_FRAME;  /* delayed intra frame */
+         }
+     }
+     cpi->force_next_frame_intra = 0;
+ #endif
      // For an alt ref frame in 2 pass we skip the call to the second pass function that sets the target bandwidth
  #if !(CONFIG_REALTIME_ONLY)
  
index 41ebd3bcdd8ca7d0d75d0d1f2054a39b75901095,e8a452dca7e65baa409c1e94cd39cd23c53d28b7..d0e48eee21ba44c2b4f705d4af44099a5061de76
@@@ -191,15 -191,8 +191,12 @@@ typedef struc
  typedef struct
  {
      MACROBLOCK  mb;
-     int mb_row;
-     TOKENEXTRA *tp;
 +#if CONFIG_SEGMENTATION
 +    int segment_counts[MAX_MB_SEGMENTS + 8];
 +#else
      int segment_counts[MAX_MB_SEGMENTS];
 +#endif
      int totalrate;
-     int current_mb_col;
  } MB_ROW_COMP;
  
  typedef struct