| 1884 | } |
| 1885 | |
| 1886 | static int slice_decode_thread(AVCodecContext *c, void *arg){ |
| 1887 | MpegEncContext *s= *(void**)arg; |
| 1888 | const uint8_t *buf= s->gb.buffer; |
| 1889 | int mb_y= s->start_mb_y; |
| 1890 | const int field_pic= s->picture_structure != PICT_FRAME; |
| 1891 | |
| 1892 | s->error_count= (3*(s->end_mb_y - s->start_mb_y)*s->mb_width) >> field_pic; |
| 1893 | |
| 1894 | for(;;){ |
| 1895 | uint32_t start_code; |
| 1896 | int ret; |
| 1897 | |
| 1898 | ret= mpeg_decode_slice((Mpeg1Context*)s, mb_y, &buf, s->gb.buffer_end - buf); |
| 1899 | emms_c(); |
| 1900 | //av_log(c, AV_LOG_DEBUG, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n", |
| 1901 | //ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, s->start_mb_y, s->end_mb_y, s->error_count); |
| 1902 | if(ret < 0){ |
| 1903 | if(s->resync_mb_x>=0 && s->resync_mb_y>=0) |
| 1904 | ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, AC_ERROR|DC_ERROR|MV_ERROR); |
| 1905 | }else{ |
| 1906 | ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END); |
| 1907 | } |
| 1908 | |
| 1909 | if(s->mb_y == s->end_mb_y) |
| 1910 | return 0; |
| 1911 | |
| 1912 | start_code= -1; |
| 1913 | buf = ff_find_start_code(buf, s->gb.buffer_end, &start_code); |
| 1914 | mb_y= start_code - SLICE_MIN_START_CODE; |
| 1915 | if(mb_y < 0 || mb_y >= s->end_mb_y) |
| 1916 | return -1; |
| 1917 | } |
| 1918 | |
| 1919 | return 0; //not reached |
| 1920 | } |
| 1921 | |
| 1922 | /** |
| 1923 | * Handles slice ends. |
nothing calls this directly
no test coverage detected