View | Details | Raw Unified | Return to bug 1218429
Collapse All | Expand All

(-)libaom-3.2.0/av1/common/thread_common.c (-3 / +4 lines)
Lines 615-621 void av1_loop_restoration_alloc(AV1LrSyn Link Here
615
}
615
}
616
616
617
// Deallocate loop restoration synchronization related mutex and data
617
// Deallocate loop restoration synchronization related mutex and data
618
void av1_loop_restoration_dealloc(AV1LrSync *lr_sync, int num_workers) {
618
void av1_loop_restoration_dealloc(AV1LrSync *lr_sync) {
619
  if (lr_sync != NULL) {
619
  if (lr_sync != NULL) {
620
    int j;
620
    int j;
621
#if CONFIG_MULTITHREAD
621
#if CONFIG_MULTITHREAD
Lines 646-652 void av1_loop_restoration_dealloc(AV1LrS Link Here
646
    aom_free(lr_sync->job_queue);
646
    aom_free(lr_sync->job_queue);
647
647
648
    if (lr_sync->lrworkerdata) {
648
    if (lr_sync->lrworkerdata) {
649
      for (int worker_idx = 0; worker_idx < num_workers - 1; worker_idx++) {
649
      for (int worker_idx = 0; worker_idx < lr_sync->num_workers - 1;
650
           worker_idx++) {
650
        LRWorkerData *const workerdata_data =
651
        LRWorkerData *const workerdata_data =
651
            lr_sync->lrworkerdata + worker_idx;
652
            lr_sync->lrworkerdata + worker_idx;
652
653
Lines 843-849 static void foreach_rest_unit_in_planes_ Link Here
843
844
844
  if (!lr_sync->sync_range || num_rows_lr > lr_sync->rows ||
845
  if (!lr_sync->sync_range || num_rows_lr > lr_sync->rows ||
845
      num_workers > lr_sync->num_workers || num_planes > lr_sync->num_planes) {
846
      num_workers > lr_sync->num_workers || num_planes > lr_sync->num_planes) {
846
    av1_loop_restoration_dealloc(lr_sync, num_workers);
847
    av1_loop_restoration_dealloc(lr_sync);
847
    av1_loop_restoration_alloc(lr_sync, cm, num_workers, num_rows_lr,
848
    av1_loop_restoration_alloc(lr_sync, cm, num_workers, num_rows_lr,
848
                               num_planes, cm->width);
849
                               num_planes, cm->width);
849
  }
850
  }
(-)libaom-3.2.0/av1/common/thread_common.h (-1 / +1 lines)
Lines 165-171 void av1_loop_restoration_filter_frame_m Link Here
165
                                          int optimized_lr, AVxWorker *workers,
165
                                          int optimized_lr, AVxWorker *workers,
166
                                          int num_workers, AV1LrSync *lr_sync,
166
                                          int num_workers, AV1LrSync *lr_sync,
167
                                          void *lr_ctxt);
167
                                          void *lr_ctxt);
168
void av1_loop_restoration_dealloc(AV1LrSync *lr_sync, int num_workers);
168
void av1_loop_restoration_dealloc(AV1LrSync *lr_sync);
169
void av1_loop_restoration_alloc(AV1LrSync *lr_sync, AV1_COMMON *cm,
169
void av1_loop_restoration_alloc(AV1LrSync *lr_sync, AV1_COMMON *cm,
170
                                int num_workers, int num_rows_lr,
170
                                int num_workers, int num_rows_lr,
171
                                int num_planes, int width);
171
                                int num_planes, int width);
(-)libaom-3.2.0/av1/decoder/decoder.c (-1 / +1 lines)
Lines 217-223 void av1_decoder_remove(AV1Decoder *pbi) Link Here
217
  if (pbi->num_workers > 0) {
217
  if (pbi->num_workers > 0) {
218
    av1_loop_filter_dealloc(&pbi->lf_row_sync);
218
    av1_loop_filter_dealloc(&pbi->lf_row_sync);
219
#if !CONFIG_REALTIME_ONLY
219
#if !CONFIG_REALTIME_ONLY
220
    av1_loop_restoration_dealloc(&pbi->lr_row_sync, pbi->num_workers);
220
    av1_loop_restoration_dealloc(&pbi->lr_row_sync);
221
#endif
221
#endif
222
    av1_dealloc_dec_jobs(&pbi->tile_mt_info);
222
    av1_dealloc_dec_jobs(&pbi->tile_mt_info);
223
  }
223
  }
(-)libaom-3.2.0/av1/encoder/encoder.c (-3 / +1 lines)
Lines 1584-1592 void av1_remove_compressor(AV1_COMP *cpi Link Here
1584
    av1_loop_filter_dealloc(&mt_info->lf_row_sync);
1584
    av1_loop_filter_dealloc(&mt_info->lf_row_sync);
1585
    av1_cdef_mt_dealloc(&mt_info->cdef_sync);
1585
    av1_cdef_mt_dealloc(&mt_info->cdef_sync);
1586
#if !CONFIG_REALTIME_ONLY
1586
#if !CONFIG_REALTIME_ONLY
1587
    int num_lr_workers =
1587
    av1_loop_restoration_dealloc(&mt_info->lr_row_sync);
1588
        av1_get_num_mod_workers_for_alloc(&cpi->ppi->p_mt_info, MOD_LR);
1589
    av1_loop_restoration_dealloc(&mt_info->lr_row_sync, num_lr_workers);
1590
    av1_gm_dealloc(&mt_info->gm_sync);
1588
    av1_gm_dealloc(&mt_info->gm_sync);
1591
    av1_tf_mt_dealloc(&mt_info->tf_sync);
1589
    av1_tf_mt_dealloc(&mt_info->tf_sync);
1592
#endif
1590
#endif
(-)libaom-3.2.0/av1/encoder/ethread.c (-3 / +5 lines)
Lines 650-656 void av1_init_mt_sync(AV1_COMP *cpi, int Link Here
650
    if (!lr_sync->sync_range || num_rows_lr > lr_sync->rows ||
650
    if (!lr_sync->sync_range || num_rows_lr > lr_sync->rows ||
651
        num_lr_workers > lr_sync->num_workers ||
651
        num_lr_workers > lr_sync->num_workers ||
652
        MAX_MB_PLANE > lr_sync->num_planes) {
652
        MAX_MB_PLANE > lr_sync->num_planes) {
653
      av1_loop_restoration_dealloc(lr_sync, num_lr_workers);
653
      av1_loop_restoration_dealloc(lr_sync);
654
      av1_loop_restoration_alloc(lr_sync, cm, num_lr_workers, num_rows_lr,
654
      av1_loop_restoration_alloc(lr_sync, cm, num_lr_workers, num_rows_lr,
655
                                 MAX_MB_PLANE, cm->width);
655
                                 MAX_MB_PLANE, cm->width);
656
    }
656
    }
Lines 2649-2655 static AOM_INLINE int compute_num_pack_b Link Here
2649
  return compute_num_enc_tile_mt_workers(&cpi->common, cpi->oxcf.max_threads);
2649
  return compute_num_enc_tile_mt_workers(&cpi->common, cpi->oxcf.max_threads);
2650
}
2650
}
2651
2651
2652
int compute_num_mod_workers(AV1_COMP *cpi, MULTI_THREADED_MODULES mod_name) {
2652
static int compute_num_mod_workers(AV1_COMP *cpi,
2653
                                   MULTI_THREADED_MODULES mod_name) {
2653
  int num_mod_workers = 0;
2654
  int num_mod_workers = 0;
2654
  switch (mod_name) {
2655
  switch (mod_name) {
2655
    case MOD_FP:
2656
    case MOD_FP:
Lines 2681-2687 int compute_num_mod_workers(AV1_COMP *cp Link Here
2681
}
2682
}
2682
// Computes the number of workers for each MT modules in the encoder
2683
// Computes the number of workers for each MT modules in the encoder
2683
void av1_compute_num_workers_for_mt(AV1_COMP *cpi) {
2684
void av1_compute_num_workers_for_mt(AV1_COMP *cpi) {
2684
  for (int i = MOD_FP; i < NUM_MT_MODULES; i++)
2685
  for (int i = MOD_FP; i < NUM_MT_MODULES; i++) {
2685
    cpi->ppi->p_mt_info.num_mod_workers[i] =
2686
    cpi->ppi->p_mt_info.num_mod_workers[i] =
2686
        compute_num_mod_workers(cpi, (MULTI_THREADED_MODULES)i);
2687
        compute_num_mod_workers(cpi, (MULTI_THREADED_MODULES)i);
2688
  }
2687
}
2689
}
(-)libaom-3.2.0/av1/av1_cx_iface.c (-1 / +3 lines)
Lines 2816-2822 static aom_codec_err_t encoder_encode(ao Link Here
2816
    if ((num_workers > 1) && (ppi->p_mt_info.num_workers == 0)) {
2816
    if ((num_workers > 1) && (ppi->p_mt_info.num_workers == 0)) {
2817
      av1_create_workers(ppi, num_workers);
2817
      av1_create_workers(ppi, num_workers);
2818
      av1_init_tile_thread_data(ppi, cpi->oxcf.pass == AOM_RC_FIRST_PASS);
2818
      av1_init_tile_thread_data(ppi, cpi->oxcf.pass == AOM_RC_FIRST_PASS);
2819
    }
2819
#if CONFIG_MULTITHREAD
2820
#if CONFIG_MULTITHREAD
2821
    if (ppi->p_mt_info.num_workers > 1) {
2820
#if CONFIG_FRAME_PARALLEL_ENCODE
2822
#if CONFIG_FRAME_PARALLEL_ENCODE
2821
      for (int i = 0; i < ppi->num_fp_contexts; i++) {
2823
      for (int i = 0; i < ppi->num_fp_contexts; i++) {
2822
        av1_init_mt_sync(ppi->parallel_cpi[i],
2824
        av1_init_mt_sync(ppi->parallel_cpi[i],
Lines 2828-2835 static aom_codec_err_t encoder_encode(ao Link Here
2828
      if (cpi_lap != NULL) {
2830
      if (cpi_lap != NULL) {
2829
        av1_init_mt_sync(cpi_lap, 1);
2831
        av1_init_mt_sync(cpi_lap, 1);
2830
      }
2832
      }
2831
#endif  // CONFIG_MULTITHREAD
2832
    }
2833
    }
2834
#endif  // CONFIG_MULTITHREAD
2833
#if CONFIG_FRAME_PARALLEL_ENCODE
2835
#if CONFIG_FRAME_PARALLEL_ENCODE
2834
    for (int i = 0; i < ppi->num_fp_contexts; i++) {
2836
    for (int i = 0; i < ppi->num_fp_contexts; i++) {
2835
      av1_init_frame_mt(ppi, ppi->parallel_cpi[i]);
2837
      av1_init_frame_mt(ppi, ppi->parallel_cpi[i]);

Return to bug 1218429